svx/source/dialog/imapdlg.cxx    |    5 +++--
 svx/source/engine3d/float3d.cxx  |    4 ++--
 svx/source/tbxctrls/tbxcolor.cxx |    5 +++--
 3 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit b1e38819eaeeb259ede09f8d886d037ae7675f04
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Dec 15 17:14:07 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Dec 16 08:51:22 2022 +0000

    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 <caol...@redhat.com>

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;

Reply via email to