sw/source/core/layout/wsfrm.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 0411e70f45d9b0ac05cad557b6b0c0f45952c279
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Jul 5 16:47:10 2022 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jul 8 11:46:54 2022 +0200

    sw: fix null derefs of GetCurrShell()
    
    See 
https://crashreport.libreoffice.org/stats/signature/SwContentFrame::Cut()
    
    Change-Id: I00267b480d9c123f68996572d2e6fdebc4fb383f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136769
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 43bd9a7037a1..65b9383543eb 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1222,13 +1222,14 @@ void SwContentFrame::Cut()
                 // find if there are pages without content following pPage
                 // and if so request a call to CheckPageDescs()
                 SwPageFrame const* pNext(pPage);
-                if (pRoot->GetCurrShell()->Imp()->IsAction())
+                SwViewShell *pSh = pRoot->GetCurrShell();
+                if (pSh && pSh->Imp()->IsAction())
                 {
                     while ((pNext = static_cast<SwPageFrame 
const*>(pNext->GetNext())))
                     {
                         if (!sw::IsPageFrameEmpty(*pNext) && 
!pNext->IsFootnotePage())
                         {
-                            
pRoot->GetCurrShell()->Imp()->GetLayAction().SetCheckPageNum(pPage->GetPhyPageNum());
+                            
pSh->Imp()->GetLayAction().SetCheckPageNum(pPage->GetPhyPageNum());
                             break;
                         }
                     }

Reply via email to