summaryrefslogtreecommitdiff
path: root/sd/source/ui/docshell
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-15 20:25:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-16 10:23:20 +0000
commit4a9c9488ee918879e89751a15f3ef0fcbbcd2070 (patch)
tree96051cc2fa73ac15a22b808287039f5ad98499f7 /sd/source/ui/docshell
parent70e2383eaad96c8a6079613d9924063f41880724 (diff)
sd: 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: Ife81c0e5fc508d8eb30808884c61b8e8c6723890 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144279 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source/ui/docshell')
-rw-r--r--sd/source/ui/docshell/docshel4.cxx15
-rw-r--r--sd/source/ui/docshell/docshell.cxx4
2 files changed, 10 insertions, 9 deletions
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 13b08deafa1a..99d6890fe1f0 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -851,12 +851,14 @@ void DrawDocShell::GotoBookmark(std::u16string_view rBookmark)
}
}
- SfxBindings& rBindings = ((pDrawViewShell && pDrawViewShell->GetViewFrame()!=nullptr)
+ if (SfxViewFrame* pViewFrame = (pDrawViewShell && pDrawViewShell->GetViewFrame())
? pDrawViewShell->GetViewFrame()
- : SfxViewFrame::Current() )->GetBindings();
-
- rBindings.Invalidate(SID_NAVIGATOR_STATE, true);
- rBindings.Invalidate(SID_NAVIGATOR_PAGENAME);
+ : SfxViewFrame::Current())
+ {
+ SfxBindings& rBindings = pViewFrame->GetBindings();
+ rBindings.Invalidate(SID_NAVIGATOR_STATE, true);
+ rBindings.Invalidate(SID_NAVIGATOR_PAGENAME);
+ }
}
/**
@@ -964,7 +966,8 @@ void DrawDocShell::OpenBookmark( const OUString& rBookmarkURL )
SfxStringItem aStrItem( SID_FILE_NAME, rBookmarkURL );
SfxStringItem aReferer( SID_REFERER, GetMedium()->GetName() );
const SfxPoolItem* ppArgs[] = { &aStrItem, &aReferer, nullptr };
- ( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs );
+ if (SfxViewFrame* pFrame = mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current())
+ pFrame->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs );
}
std::shared_ptr<SfxDocumentInfoDialog> DrawDocShell::CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet &rSet)
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
index 78279687a039..d837092eba68 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -336,9 +336,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
nWhich = aIter.NextWhich();
}
- SfxViewFrame* pFrame = SfxViewFrame::Current();
-
- if (pFrame)
+ if (SfxViewFrame* pFrame = SfxViewFrame::Current())
{
if (rSet.GetItemState(SID_RELOAD) != SfxItemState::UNKNOWN)
{