From a62af0444515ab28bc0ffdc8ff7f320ca962bbc0 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 4 Jul 2023 17:56:05 +0200 Subject: [PATCH] sw: fix crash in SwTextNode::Update FindPageFrame might return nullptr Introduced with c684301352bcca709bc8d1c99e0f08e7096e9716 "(related: tdf#149595) sw: also re-sort SwSortedObjs on SwPageFrame" See https://crashreport.libreoffice.org/stats/signature/SwTextNode::Update(SwContentIndex%20const%20&,long,SwContentIndexReg::UpdateMode) Change-Id: I2e8df1428400f6752eafaaa6102a1fc3de3f0daa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153977 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/txtnode/ndtxt.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index f46fbdc69c77..8eea1b74f11e 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1603,7 +1603,9 @@ void SwTextNode::Update( pSortedObjs->UpdateAll(); } // also sort the objs on the page frame - pSortedObjs = pFrame->FindPageFrame()->GetSortedObjs(); + if (SwPageFrame *pPage = pFrame->FindPageFrame()) + pSortedObjs = pPage->GetSortedObjs(); + if (pSortedObjs) // doesn't exist yet if called for inserting as-char fly { pSortedObjs->UpdateAll();