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

New commits:
commit 17e7ed4f60842ab4a1a1e82d12c1552d39aaba02
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Dec 21 20:20:29 2023 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Jan 5 14:20:14 2024 +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/+/161155
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 9f6fda81abd1..f242de30f739 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2418,7 +2418,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