https://bugs.documentfoundation.org/show_bug.cgi?id=161511

            Bug ID: 161511
           Summary: [CRASH] Macro using seekGoal crashes on a brand new
                    document
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Consider the following macro that runs Goal Seek (using seekGoal from the UNO
API):

Sub TestGoalSeek
  oSheet = ThisComponent.Sheets(0)
  oTargetCell = oSheet.getCellRangeByName("D1")
  oVariableCell = oSheet.getCellRangeByName("C1")
  oResult = Thiscomponent.seekGoal(oTargetCell.CellAddress,
oVariableCell.CellAddress, "100")
  MsgBox oResult.Result
End Sub

If you create a blank Calc document and run the macro (without changing
anything in the document), LO will crash.

Steps to reproduce:
1) Copy the macro above to any module in the Standard library (so that it can
be run from any document)
2) Create a blank new Calc document
3) Go to Tools - Macro - Run Macro and choose the macro TestGoalSeek
4) Run the macro
5) CRASH

The weird thing is that if you simply change the values in cells C1 or D1, the
crash won't happen. For instance:

0) Create a blank Calc document
1) Enter any value in cell D1
2) Delete this value and leave the cell empty
3) Run the macro
4) No crash... the macro works, even though the document is empty

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to