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

--- Comment #5 from mrupio <[email protected]> ---
I tried this code

Sub Test_NoError
  Dim arr2 As Variant
  arr2 = Iif(false, getArray(), getArray())     
End Sub

Sub Test_Error
  Dim arr2 As Variant
  arr2 = Iif(true, getArray(), getArray())      
End Sub

Function getArray() As Variant
  Dim arr As Variant
  arr  = Array("A","B")
  getArray = arr
End Function

with the same results (invocation with "true" - error, with "false" - no
error).

Next, I changed SbRtl_Iif function (see
https://opengrok.libreoffice.org/xref/core/basic/source/runtime/methods1.cxx?r=b710ba48503372ddaf10a17ce7f4f3340bc8adb8#405
) into

void SbRtl_Iif(StarBASIC*, SbxArray& rPar, bool)
{
    if (rPar.Count() != 4)
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
    *rPar.Get(0) = *rPar.Get(2);
}

so that first argument of "iif" doesn't matter... Or does it? The results are
still the same.
Despite the fact that the modified function doesn't check if the "iif" function
was called with true or false, the results are still the same.
So, the error occurs or not even when the paths of SbRtl_Iif execution are the
same. It only depends on whether "iif" was called with true or false.

The same happens with function:

void SbRtl_Iif(StarBASIC*, SbxArray& rPar, bool)
{
    if (rPar.Count() != 4)
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
    *rPar.Get(0) = *rPar.Get(3);
}

What do you think?

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

Reply via email to