summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui/bookctrl.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-15 16:40:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-15 21:30:31 +0000
commit54aa8993baba2a9463a5b412c6c7575efa89bb67 (patch)
tree45c5cc0151b380a21b2f684914e32eccd765952c /sw/source/uibase/utlui/bookctrl.cxx
parent183f5e38ee775f2e8c57bd061db80baf7da3b4c7 (diff)
sw: check SfxViewFrame::Current()
SfxViewFrame::Current() is a festering wound, these ones look like they were safe anyway, so no need to backport. But with enough checked static analysis will kick in to flag new unchecked ones. Change-Id: I359d71bda2ad1f8f720fae1f87a13eae94bb763c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144244 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/utlui/bookctrl.cxx')
-rw-r--r--sw/source/uibase/utlui/bookctrl.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index 77567198257c..4cd9029fd339 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -75,6 +75,10 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt )
if( !(pWrtShell && pWrtShell->getIDocumentMarkAccess()->getAllMarksCount() > 0) )
return;
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (!pViewFrm)
+ return;
+
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/bookmarkmenu.ui"));
std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu"));
@@ -99,7 +103,7 @@ void SwBookmarkControl::Command( const CommandEvent& rCEvt )
if (!sResult.isEmpty())
{
SfxUInt16Item aBookmark( FN_STAT_BOOKMARK, aBookmarkIdx[sResult.toUInt32()] );
- SfxViewFrame::Current()->GetDispatcher()->ExecuteList(FN_STAT_BOOKMARK,
+ pViewFrm->GetDispatcher()->ExecuteList(FN_STAT_BOOKMARK,
SfxCallMode::ASYNCHRON|SfxCallMode::RECORD,
{ &aBookmark });
}