To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=84433
Issue #|84433
Summary|Function return is inconsistent when the value is 'Emp
|ty'
Component|scripting
Version|OOo 2.3.1 RC1
Platform|All
URL|
OS/Version|All
Status|NEW
Status whiteboard|
Keywords|
Resolution|
Issue type|DEFECT
Priority|P3
Subcomponent|code
Assigned to|kr
Reported by|silvercapo
------- Additional comments from [EMAIL PROTECTED] Mon Dec 10 15:20:55 +0000
2007 -------
NOTE: This was observed on the OOo 2.3.1 actual release (Not RC1), but can't yet
select this from this reporting tool.
When a OOoBasic function return is unassigned/uninitialised, IsEmpty on the
return value can still return False. This happens when there is a previous call
to that function that returned an assigned/initialised value.
STEPS TO REPRODUCE THE PROBLEM:
1. Open any OOo application, and create an OOoBasic macro in the Basic IDE as
follows:
Sub Code_Test
MsgBox(IsEmpty(Bug_Demo(False)))
MsgBox(IsEmpty(Bug_Demo(True)))
MsgBox(IsEmpty(Bug_Demo(False)))
End Sub
Function Bug_Demo(bAssignReturnValue As Boolean) As Variant
If bAssignReturnValue Then
Bug_Demo = "Assigned a value"
End If
End Function
2. Run Code_Test: the result is three dialog boxes as follows: "True", "False",
"False". The third MsgBox call is exactly the same as the first, but IsEmpty
evaluates to different values.
3. Furthermore, if you run Code_Test a second time, the result is now: "False",
"False", "False"; giving different results than the first execution, even though
there are no global or static variables defined here.
POSSIBLE WORKAROUND
Seem to be able to work around this if an intermediate variable is introduced in
Bug_Demo as follows:
Function Bug_Demo(bAssignReturnValue As Boolean) As Variant
Dim vReturnValue As Variant
If bAssignReturnValue Then
vReturnValue = "Assigned a value"
End If
Bug_Demo = vReturnValue
End Function
vReturnValue is correctly assigned to Empty every time, and thus Bug_Demo always
returns Empty when (bAssignReturnValue = False)
PROPOSED SOLUTION
A function should return Empty everytime if the return value is unassigned.
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]