Created attachment 174851 [details] A sample with a macro setting object's layer using missing argument value Open attachment; run "Main" macro in it. The macro code is: Sub SetOptionalLayer(Optional i) d = thisComponent p = d.DrawPages(0) s = p(0) s.LayerID = i End Sub Sub Main SetOptionalLayer End Sub The expected result is an error "argument is not optional" at line "s.LayerID = i", while the actual result is "IllegalArgumentException", which shows that the value is passed to UNO, and the wrong value is only caught there.
Repo with: Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community Build ID: 769ed9edaf5e61c6c151cf4ec5bbe25e70e0438c CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: en-US Calc: CL Imho there should be an error on the following situation, too: Sub Test(Optional i) MsgBox i + 10 End Sub Sub Main() Test End Sub The actual result atm is the error code 448 + 10 = 458
Repro also in: Version: 6.4.7.2 (x64) Build ID: 639b8ac485750d5696d7590a72ef1b496725cfb5 CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: default; VCL: win; Locale: de-DE (de_DE); UI-Language: en-US Calc: CL
Created attachment 174868 [details] bt with debug symbols On pc Debian x86-64 with master sources update today, I got an assertion. I must recognize I don't understand where does the 448 value comes from.
It will be set in: https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=2bc1a043#4148 (// like in VB: Error-Code 448 (ERRCODE_BASIC_NAMED_NOT_FOUND)
Thank you Andreas for the very quick feedback! And this pb will be fixed with https://gerrit.libreoffice.org/c/core/+/121760
At least assigning a missing optional variable to a property may be fixed in: https://gerrit.libreoffice.org/c/core/+/121794 However, the issue with comment #1 is still not addressed. Should we allow to do some calculations, if an argument is missing?
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/e32d864dbe086d630a8b17c2d376e320aee0253a tdf#144353 - Handling of missing optional parameters It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/d8428094c7f8b186b37c76fd7e9508a075424f80 tdf#144353, tdf#146281 - Correctly copy the information about variables It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/1a343e3168c6ac8acf3279307275727e588ddcb7 tdf#144353, tdf#146281 - Correctly copy the information about variables It will be available in 7.3.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.