sd/source/ui/view/Outliner.cxx |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit fa647d10c8c4d9293c5056fd4ecd5f57a542ff6a
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Oct 31 18:04:20 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Nov 6 20:38:15 2024 +0100

    tdf#163486: PVS: check getViewShellBase
    
    V522    There might be dereferencing of a potential null pointer 
'getViewShellBase()'.
    
    Change-Id: I19becd2a40a7e996b6634c20df309d171ebbaf1f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175882
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175887
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 8f33f1edbde7..867daa748527 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1756,20 +1756,22 @@ void SdOutliner::EnterEditMode (bool bGrabFocus)
     }
     else
     {
-        std::shared_ptr<sd::ViewShell> pOverridingViewShell{};
-        sd::ViewShellBase* pBase = getViewShellBase();
-        if (auto pViewShellManager = pBase->GetViewShellManager())
-            pOverridingViewShell = pViewShellManager->GetOverridingMainShell();
-
-        if (pOverridingViewShell)
+        if (sd::ViewShellBase* pBase = getViewShellBase())
         {
-            
getViewShellBase()->GetMainViewShell()->GetParentWindow()->GrabFocus();
-            
getViewShellBase()->GetMainViewShell()->GetContentWindow()->GrabFocus();
-            bGrabFocus = true;
-        }
+            std::shared_ptr<sd::ViewShell> pOverridingViewShell{};
+            if (auto pViewShellManager = pBase->GetViewShellManager())
+                pOverridingViewShell = 
pViewShellManager->GetOverridingMainShell();
 
-        mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, true, 
this, pOutlinerView,
-                                 true, true, bGrabFocus);
+            if (pOverridingViewShell)
+            {
+                pBase->GetMainViewShell()->GetParentWindow()->GrabFocus();
+                pBase->GetMainViewShell()->GetContentWindow()->GrabFocus();
+                bGrabFocus = true;
+            }
+
+            mpView->SdrBeginTextEdit(mpSearchSpellTextObj, pPV, mpWindow, 
true, this, pOutlinerView,
+                                     true, true, bGrabFocus);
+        }
     }
 
     mbFoundObject = true;

Reply via email to