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

New commits:
commit f9c857563f2a8837c6ec83851369badbcfa22185
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:36:17 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/+/144241
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Jenkins

diff --git a/sd/source/ui/view/unmodpg.cxx b/sd/source/ui/view/unmodpg.cxx
index 2fdfbd13a9bb..afd454a5f183 100644
--- a/sd/source/ui/view/unmodpg.cxx
+++ b/sd/source/ui/view/unmodpg.cxx
@@ -118,8 +118,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()
@@ -161,8 +165,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