diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-05 16:47:10 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-07-11 19:04:34 +0200 |
commit | 9853c9e4e39546232d340a4d93805f3b63ed55b2 (patch) | |
tree | ee2af7d1aed418af76534ba0eb1878bae6d2b352 | |
parent | c3ecc9d8c3b81cebf6f707f397f096df3ccecbe4 (diff) |
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.stahl@allotropia.de>
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
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; } } |