Description: Executing the method insertControlCharacter in debug mode ("step into") in the Basic IDE without the parameter nControlCharacter does not raise an error, but it also does not appear to do anything. Additional information: Discussion on forum: https://ask.libreoffice.org/t/insertcontrolcharacter-ncontrolcharacter-parameter-optional/109240 Short video clip showing the behavior: https://nextcloud.culp.de/index.php/s/ACWaSm2N7NTgHAy
I confirm it in: Version: 24.2.5.2 (X86_64) / LibreOffice Community Build ID: 420(Build:2) CPU threads: 16; OS: Linux 6.10; UI render: default; VCL: gtk3 Locale: es-MX (en_US.UTF-8); UI: en-US 24.2.5-1 Calc: threaded
Thanks for filing! Now let me add what is more important that discussion on forum and short video clip, and what needed to be from start: namely, steps to reproduce. 1. Create a new text document. 2. Execute this Basic code: sub TestMissingParam txt = ThisComponent.Text txt.insertControlCharacter(txt.End, , false) end sub Expected: either an error telling that the second argument is missing, or an effect associated with a (some) default argument value. Actual result: the code succeeds silently, doing nothing.
The "is missing" error gets silently converted to the expected "short" integer type value 448, which is not any known control character identifier. I believe, that the change is needed in sbxToUnoValue [1]; it needs to check for "is missing" variable (similar to [2]), and set an error, when the target type can't handle a missing value (like integers, or strings - possibly anything except plain Any, the latter can simply be returned empty), even prior to the external call. Andreas: are you interested to take this? :-) [1] https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbunoobj.cxx?r=8f008bf4#1167 [2] https://opengrok.libreoffice.org/xref/core/basic/source/runtime/methods.cxx?r=45290d41#3165
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/4506cd04c78baf628c8c6fd7e9c5f27a407d8f87 tdf#162431 - Check for missing parameters It will be available in 25.2.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-24-8": https://git.libreoffice.org/core/commit/f69de110cc73e4b10941cee17c86f89590e43bfa tdf#162431 - Check for missing parameters It will be available in 24.8.2. 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.