diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-12-15 17:14:07 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-12-16 08:51:22 +0000 |
commit | b1e38819eaeeb259ede09f8d886d037ae7675f04 (patch) | |
tree | 143e91a94e240eaa946194fbddfb747ce2c78e6b /svx/source | |
parent | 1f59a2abcd68aab710e9502b1e00f172f569cb67 (diff) |
svx: 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: I846a67ca7392182fee6afead8d066fc061ce00be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144253
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/imapdlg.cxx | 5 | ||||
-rw-r--r-- | svx/source/engine3d/float3d.cxx | 4 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbxcolor.cxx | 5 |
3 files changed, 8 insertions, 6 deletions
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index 2eda3129b1c7..3caa47824c8e 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -719,8 +719,9 @@ IMPL_LINK( SvxIMapDlg, StateHdl, GraphCtrl*, pWnd, void ) SvxIMapDlg* GetIMapDlg() { SfxChildWindow* pWnd = nullptr; - if (SfxViewFrame::Current() && SfxViewFrame::Current()->HasChildWindow(SvxIMapDlgChildWindow::GetChildWindowId())) - pWnd = SfxViewFrame::Current()->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()); + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + if (pViewFrm && pViewFrm->HasChildWindow(SvxIMapDlgChildWindow::GetChildWindowId())) + pWnd = pViewFrm->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId()); return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetController().get()) : nullptr; } diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index 65d6e4d13a8d..d548ea254dcd 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -74,8 +74,8 @@ namespace { { SfxDispatcher* pDispatcher = nullptr; - if (SfxViewFrame::Current() != nullptr) - pDispatcher = SfxViewFrame::Current()->GetDispatcher(); + if (SfxViewFrame* pViewFrame = SfxViewFrame::Current()) + pDispatcher = pViewFrame->GetDispatcher(); else if (pBindings != nullptr) pDispatcher = pBindings->GetDispatcher(); diff --git a/svx/source/tbxctrls/tbxcolor.cxx b/svx/source/tbxctrls/tbxcolor.cxx index 35dad5eb9f3d..97e4898065fe 100644 --- a/svx/source/tbxctrls/tbxcolor.cxx +++ b/svx/source/tbxctrls/tbxcolor.cxx @@ -39,12 +39,13 @@ namespace svx m_sToolboxResName += rToolboxName; // the layout manager - if ( !SfxViewFrame::Current() ) + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + if (!pViewFrm) return; try { - Reference< XFrame > xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface(); + Reference< XFrame > xFrame = pViewFrm->GetFrame().GetFrameInterface(); Reference< XPropertySet > xFrameProps( xFrame, UNO_QUERY ); if ( xFrameProps.is() ) xFrameProps->getPropertyValue( "LayoutManager" ) >>= m_xLayouter; |