sw/source/uibase/app/docsh2.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 0c9fafe07df10d541251f494b28fcb89e5387cda
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Mar 16 16:26:17 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Mar 16 19:12:20 2023 +0000

    sw: fix null dereference
    
    See 
https://crashreport.libreoffice.org/stats/signature/SfxDispatcher::ExecuteList(unsigned%20short,SfxCallMode,std::initializer_list%3CSfxPoolItem%20const%20*%3E,std::initializer_list%3CSfxPoolItem%20const%20*%3E)
    
    Change-Id: I7f5471f003798f260d9d015782bd2a798baa22d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148999
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 3cbd7673a6b7..8f5c4e8d40b8 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1197,11 +1197,12 @@ void SwDocShell::Execute(SfxRequest& rReq)
                 // Ok.  I did my best.
                 break;
 
-            SfxStringItem aApp(SID_DOC_SERVICE, 
"com.sun.star.text.TextDocument");
-            SfxStringItem aTarget(SID_TARGETNAME, "_blank");
-            pViewShell->GetDispatcher()->ExecuteList(SID_OPENDOC,
-                SfxCallMode::API|SfxCallMode::SYNCHRON,
-                { &aApp, &aTarget });
+            if (SfxDispatcher* pDispatch = pViewShell->GetDispatcher())
+            {
+                SfxStringItem aApp(SID_DOC_SERVICE, 
"com.sun.star.text.TextDocument");
+                SfxStringItem aTarget(SID_TARGETNAME, "_blank");
+                pDispatch->ExecuteList(SID_OPENDOC, 
SfxCallMode::API|SfxCallMode::SYNCHRON, { &aApp, &aTarget });
+            }
         }
         break;
         case SID_CLASSIFICATION_APPLY:

Reply via email to