summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-06-01 20:19:36 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-06-02 17:18:41 +0200
commit710af7d183370ca6fdd2699ea9f4550d9e53918a (patch)
treee6e6c98e5d3350a108340d8940d11d25ebca6f30 /sw/source
parent69a3bcdaa54700a372151af52ccfbb0deed9db45 (diff)
tdf#152983 sw: layout: fix crash in SwContentFrame::Cut()
Surprisingly, SwContentFrame::Cut() is called in a situation where the frame is not connected to any SwPageFrame yet - it is in a follow fly of a fly chain that is anchored in a footer, and SwFlyFrame::ChainFrames() removes it. (regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb) Change-Id: Iad84b7b422126e050493dc3b181d47c4dca2fae2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152510 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/wsfrm.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index e30e3ecc401a..2834b09f70a6 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -1232,10 +1232,11 @@ void SwContentFrame::Cut()
// RemoveSuperfluous can only remove empty pages at the end;
// find if there are pages without content following pPage
// and if so request a call to CheckPageDescs()
- SwPageFrame const* pNext(pPage);
SwViewShell *pSh = pRoot->GetCurrShell();
- if (pSh && pSh->Imp()->IsAction())
+ // tdf#152983 pPage is null when called from SwHeadFootFrame ctor
+ if (pPage && pSh && pSh->Imp()->IsAction())
{
+ SwPageFrame const* pNext(pPage);
while ((pNext = static_cast<SwPageFrame const*>(pNext->GetNext())))
{
if (!sw::IsPageFrameEmpty(*pNext) && !pNext->IsFootnotePage())