Bug 160578

Summary: BASIC Runtime error. Object variable not set. Happens when the argument of sub procedure is not an object
Product: LibreOffice Reporter: Jean-Pierre Sanchez <jeanpierresanchez0000>
Component: BASICAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: normal CC: jeanpierresanchez0000, robert
Priority: medium    
Version: 7.6.5.2 release   
Hardware: All   
OS: macOS (All)   
Whiteboard:
Crash report or crash signature: Regression By:

Description Jean-Pierre Sanchez 2024-04-07 15:08:11 UTC
Description:
An unexpected runtime error when the argument of a sub procedure is a Variant that can be an object or not. 

Steps to Reproduce:
Sub Main
	Test("One")
End Sub

Sub Test(pvArg As Variant)
	On Local Error GoTo Erreur
	If IsObject(pvArg) then
		Print pvArg.SupportsService("com.sun.star.table.Cell")
	Else
		Print "pvArg is not an object"
	EndIf
	Exit Sub
Erreur: Print "Error"
End Sub

Actual Results:
Raises a runtime error on the first line of the sub procedure.
The 'On Local Error instruction' is ignored

Expected Results:
No runtime error. The argument should be tested by IsObject.


Reproducible: Always


User Profile Reset: No

Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: BasicIDE
[Information guessed from browser]
OS: Mac OS X (All)
OS is 64bit: no
Comment 1 Robert Großkopf 2024-04-12 19:00:10 UTC
You couldn't print
pvArg.SupportsService("com.sun.star.table.Cell")

You could print "Object" instead.