summaryrefslogtreecommitdiff
path: root/sd/source/ui/dlg/sdtreelb.cxx
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-05-27 16:36:23 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2024-05-27 19:58:02 +0200
commitd561f52ac8e5355c4a50f38beb81b6aff9255cca (patch)
treeb5d189553e38f7fa2c0279c99291f5ec5f41b056 /sd/source/ui/dlg/sdtreelb.cxx
parent2429b8b511d2c856ae72489da4ded5f9daaee58b (diff)
sd: warning C6011: Dereferencing NULL pointer
Change-Id: I29d7f1174c79262afd84ab8399050366dda95a76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168106 Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd/source/ui/dlg/sdtreelb.cxx')
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index b1928e52d764..3e1c8069f3bd 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -1120,11 +1120,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);
+ }
}
/**