sd/source/ui/view/unmodpg.cxx |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 49113ffad8edafbfbef46f1037bc3f05f17906c6
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Dec 15 17:20:20 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Dec 15 19:40:13 2022 +0000

    sd: fix null deref in ModifyPageUndoAction::Undo/Redo
    
    See 
https://crashreport.libreoffice.org/stats/signature/SfxViewFrame::GetDispatcher()
    
    Change-Id: Iaf14ad8fd5dab878ea5e3d6997371c2d8a4beac6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144193
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sd/source/ui/view/unmodpg.cxx b/sd/source/ui/view/unmodpg.cxx
index 047a036efe00..03d907d14a5c 100644
--- a/sd/source/ui/view/unmodpg.cxx
+++ b/sd/source/ui/view/unmodpg.cxx
@@ -117,8 +117,12 @@ void ModifyPageUndoAction::Undo()
     }
 
     // Redisplay
-    SfxViewFrame::Current()->GetDispatcher()->Execute(
-        SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+    SfxViewFrame* pCurrent = SfxViewFrame::Current();
+    if( pCurrent )
+    {
+        pCurrent->GetDispatcher()->Execute(
+            SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+    }
 }
 
 void ModifyPageUndoAction::Redo()
@@ -160,8 +164,12 @@ void ModifyPageUndoAction::Redo()
     }
 
     // Redisplay
-    SfxViewFrame::Current()->GetDispatcher()->Execute(
-        SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+    SfxViewFrame* pCurrent = SfxViewFrame::Current();
+    if( pCurrent )
+    {
+        pCurrent->GetDispatcher()->Execute(
+            SID_SWITCHPAGE, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD );
+    }
 }
 
 ModifyPageUndoAction::~ModifyPageUndoAction()

Reply via email to