sd/source/ui/framework/module/ToolBarModule.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
New commits: commit 7eaa4868e66293b995ef75b310d3831fc5d1a671 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Jul 19 09:40:10 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Jul 19 12:09:34 2024 +0200 cid#1607792 Dereference after null check Change-Id: Ib0d7380efe77b32c9c49b1d36fbf8c19fa83d783 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170747 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sd/source/ui/framework/module/ToolBarModule.cxx b/sd/source/ui/framework/module/ToolBarModule.cxx index cf3fd880105e..d630df778621 100644 --- a/sd/source/ui/framework/module/ToolBarModule.cxx +++ b/sd/source/ui/framework/module/ToolBarModule.cxx @@ -194,13 +194,16 @@ void ToolBarModule::HandleUpdateEnd() // no longer visible. This is done before the old view shell is // destroyed in order to avoid unnecessary updates of those tool // bars. - std::shared_ptr<ToolBarManager> pToolBarManager (mpBase->GetToolBarManager()); - std::shared_ptr<FrameworkHelper> pFrameworkHelper ( - FrameworkHelper::Instance(*mpBase)); - auto pViewShell - = pFrameworkHelper->GetViewShell(FrameworkHelper::msCenterPaneURL); + if (mpBase != nullptr) + { + std::shared_ptr<ToolBarManager> pToolBarManager (mpBase->GetToolBarManager()); + std::shared_ptr<FrameworkHelper> pFrameworkHelper ( + FrameworkHelper::Instance(*mpBase)); + auto pViewShell + = pFrameworkHelper->GetViewShell(FrameworkHelper::msCenterPaneURL); - UpdateToolbars(pViewShell.get()); + UpdateToolbars(pViewShell.get()); + } } // Releasing the update lock of the ToolBarManager will let the // ToolBarManager with the help of the ViewShellManager take care of