basctl/source/basicide/moduldl2.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit b96894426f187a323688953f625e21d4fdbc63f4
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Thu Dec 5 15:07:20 2024 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sat Dec 7 17:19:40 2024 +0100

    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 <rayk...@gmail.com>

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);
             }
         });

Reply via email to