Bug 164811 - Passing a Date to an UNO method results in "Object variable not set"
Summary: Passing a Date to an UNO method results in "Object variable not set"
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:25.8.0 target:25.2.1
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-23 09:12 UTC by Mike Kaganski
Modified: 2025-01-23 20:53 UTC (History)
0 users

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 Mike Kaganski 2025-01-23 09:12:02 UTC
Consider this BASIC code:

Sub TestDayFunction
  Dim d As Date
  d = "2025-01-23"

  oService = CreateUnoService("com.sun.star.sheet.FunctionAccess")
  MsgBox oService.callFunction("DAY", array(d))
End Sub

Running it produces an "Object variable not set" runtime error.
Commenting out the Dim statement, it runs correctly.

It is expected that the code runs OK.
Obviously an error in 9cdb73ff28c4cd6380412468f34ff10e46292a07, which for some reason made getUnoTypeForSbxBaseType handle IsCompatibility differently compared to the other places in the same file.
Comment 1 Mike Kaganski 2025-01-23 13:16:02 UTC
https://gerrit.libreoffice.org/c/core/+/180637
Comment 2 Commit Notification 2025-01-23 19:15:49 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/63e7a70ad1a6a8ec4190ab510f683d2fc9dea417

tdf#164811: swap the "if IsCompatibility()" branches to match other places

It will be available in 25.8.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.
Comment 3 Commit Notification 2025-01-23 20:53:06 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/014bd12ed01fbac87ca4698f48e3f6722e73e480

tdf#164811: swap the "if IsCompatibility()" branches to match other places

It will be available in 25.2.1.

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.