Bug 160578 - BASIC Runtime error. Object variable not set. Happens when the argument of sub procedure is not an object
Summary: BASIC Runtime error. Object variable not set. Happens when the argument of su...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.6.5.2 release
Hardware: All macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-07 15:08 UTC by Jean-Pierre Sanchez
Modified: 2024-04-12 19:00 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.