sfx2/source/view/viewfrm.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d58baf4aba25999afc16c7c0429963ab7d29eaf4
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Dec 21 20:20:29 2023 +0000
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Thu Dec 21 23:32:39 2023 +0100

    cid#1559856 Dereference after null check
    
    we check for a null pOldSh earlier, so logically we need to check
    here too, or drop the other null check
    
    Change-Id: I8a9110a9d1ee753f523101862fa62e20760bdb1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161156
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 24bea7e809cd..57fbb91d5d66 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2548,7 +2548,8 @@ bool SfxViewFrame::SwitchToViewShell_Impl
         // save the view data of the old view, so it can be restored later on 
(when needed)
         SaveCurrentViewData_Impl( nViewId );
 
-        pOldSh->SetDying();
+        if (pOldSh)
+            pOldSh->SetDying();
 
         // create and load new ViewShell
         SfxViewShell* pNewSh = LoadViewIntoFrame_Impl(

Reply via email to