sd/source/ui/dlg/sdtreelb.cxx | 12 +++++++----- sd/source/ui/inc/ViewShellBase.hxx | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-)
New commits: commit bcb863f132ebe8502b0f13f17cbd6185c2acdb78 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon May 27 13:35:58 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon May 27 19:58:09 2024 +0200 sd: use SAL_RET_MAYBENULL in GetViewShellBase() Change-Id: If2f9662f87b02fe42cd144daa7855424ef31db0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168097 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx index e31429f6e41a..cdec6d8a6b02 100644 --- a/sd/source/ui/inc/ViewShellBase.hxx +++ b/sd/source/ui/inc/ViewShellBase.hxx @@ -91,7 +91,7 @@ public: When the SfxViewShell of the given frame is not a ViewShellBase object then NULL is returned. */ - static ViewShellBase* GetViewShellBase (SfxViewFrame const * pFrame); + SAL_RET_MAYBENULL static ViewShellBase* GetViewShellBase (SfxViewFrame const * pFrame); DrawDocShell* GetDocShell() const { return mpDocShell;} SdDrawDocument* GetDocument() const { return mpDocument;} commit d561f52ac8e5355c4a50f38beb81b6aff9255cca Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon May 27 16:36:23 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon May 27 19:58:02 2024 +0200 sd: warning C6011: Dereferencing NULL pointer Change-Id: I29d7f1174c79262afd84ab8399050366dda95a76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168106 Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> 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); + } } /**