sd/source/ui/dlg/sdtreelb.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
New commits: commit 23f99ddb0d17d40d4b6fbbc61691a5e6521a6c6f Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon May 27 16:36:23 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Jun 27 10:09:44 2024 +0200 sd: warning C6011: Dereferencing NULL pointer Change-Id: I29d7f1174c79262afd84ab8399050366dda95a76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168064 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 63c26bc5635c..bb631b06e546 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -1097,11 +1097,13 @@ void SdPageObjsTLV::SetSdNavigator(SdNavigatorWin* pNavigator) void SdPageObjsTLV::SetViewFrame(const SfxViewFrame* pViewFrame) { - sd::ViewShellBase* pBase = sd::ViewShellBase::GetViewShellBase(pViewFrame); - std::shared_ptr<sd::ViewShell> xViewShell = pBase->GetMainViewShell(); - SAL_WARN_IF(!xViewShell, "sd", "null pBaseViewFrame"); - const css::uno::Reference< css::frame::XFrame > xFrame = xViewShell ? xViewShell->GetViewFrame()->GetFrame().GetFrameInterface() : nullptr; - m_xAccel->init(::comphelper::getProcessComponentContext(), xFrame); + if (sd::ViewShellBase* pBase = sd::ViewShellBase::GetViewShellBase(pViewFrame)) + { + std::shared_ptr<sd::ViewShell> xViewShell = pBase->GetMainViewShell(); + SAL_WARN_IF(!xViewShell, "sd", "null pBaseViewFrame"); + const css::uno::Reference< css::frame::XFrame > xFrame = xViewShell ? xViewShell->GetViewFrame()->GetFrame().GetFrameInterface() : nullptr; + m_xAccel->init(::comphelper::getProcessComponentContext(), xFrame); + } } /**