check passed functions before use

This is a follow up to commit
55e86edcb3 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 <raykowj@gmail.com>
This commit is contained in:
Jim Raykowski 2024-12-05 15:07:20 -09:00
parent ab5b5ad75d
commit b96894426f

View file

@ -817,7 +817,8 @@ void ImportLib(const ScriptDocument& rDocument, weld::Dialog* pDialog,
// remove existing libraries // remove existing libraries
if ( bRemove ) if ( bRemove )
{ {
func_remove_entry(aLibName); // LibPage::InsertLib if (func_remove_entry)
func_remove_entry(aLibName); // LibPage::InsertLib
// remove module library // remove module library
if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
@ -939,15 +940,16 @@ void ImportLib(const ScriptDocument& rDocument, weld::Dialog* pDialog,
} }
} }
} }
if (func_insert_entry)
func_insert_entry(aLibName); // LibPage::InsertLib func_insert_entry(aLibName); // LibPage::InsertLib
bChanges = true; bChanges = true;
} }
} }
if (bChanges) if (bChanges)
{ {
func_insert_entries(); // MacroManager if (func_insert_entries)
func_insert_entries(); // MacroManager
MarkDocumentModified(rDocument); MarkDocumentModified(rDocument);
} }
}); });