From b96894426f187a323688953f625e21d4fdbc63f4 Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Thu, 5 Dec 2024 15:07:20 -0900 Subject: [PATCH] check passed functions before use This is a follow up to commit 55e86edcb37a37123a69ce3e1eb9e20758415fb6 to fix a crash that occurs when importing a Basic library. The change made to functions arguments passed to ImportLib in PS28 requires they be checked for nullptr before use. For further understanding please see change to moduldl2.cxx at https:// gerrit.libreoffice.org/c/core/+/176254/27..28 Change-Id: I3f7ccc46134ddd2429c499d6e728e30331b51d7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177924 Tested-by: Jenkins Reviewed-by: Jim Raykowski --- basctl/source/basicide/moduldl2.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 259957a48c89..b61a39f7e185 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -817,7 +817,8 @@ void ImportLib(const ScriptDocument& rDocument, weld::Dialog* pDialog, // remove existing libraries if ( bRemove ) { - func_remove_entry(aLibName); // LibPage::InsertLib + if (func_remove_entry) + func_remove_entry(aLibName); // LibPage::InsertLib // remove module library if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) @@ -939,15 +940,16 @@ void ImportLib(const ScriptDocument& rDocument, weld::Dialog* pDialog, } } } - - func_insert_entry(aLibName); // LibPage::InsertLib + if (func_insert_entry) + func_insert_entry(aLibName); // LibPage::InsertLib bChanges = true; } } if (bChanges) { - func_insert_entries(); // MacroManager + if (func_insert_entries) + func_insert_entries(); // MacroManager MarkDocumentModified(rDocument); } });