From f9c857563f2a8837c6ec83851369badbcfa22185 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Thu, 15 Dec 2022 17:20:20 +0100 Subject: [PATCH] sd: fix null deref in ModifyPageUndoAction::Undo/Redo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Jenkins --- sd/source/ui/view/unmodpg.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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()