sw/source/core/doc/docnum.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
New commits: commit 8dfceb4e0b05b9d531e27e38b954f18e33091f8a Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri May 19 10:49:28 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri May 19 16:23:22 2023 +0200 sw: fix crash in GotoNextLayoutTextFrame/GotoPrevLayoutTextFrame See https://crashreport.libreoffice.org/stats/signature/sw::GotoPrevLayoutTextFrame(SwNodeIndex%20&,SwRootFrame%20const%20*) and https://crashreport.libreoffice.org/stats/signature/sw::GotoNextLayoutTextFrame(SwNodeIndex%20&,SwRootFrame%20const%20*) Change-Id: I2233078051bd653de5634f1e0dabab9c1f59acb0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151994 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index fc51f148e3c3..2ae2d23e8c63 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1441,11 +1441,16 @@ GotoPrevLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) { if (rIndex.GetNode().IsTextNode()) { - if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None && - // not a tracked row deletion in Hide Changes mode - rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout) ) + if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None) { - rIndex = *static_cast<SwTextFrame*>(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pFirstNode; + // not a tracked row deletion in Hide Changes mode + if (SwContentFrame* pFrame = rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout)) + { + if (sw::MergedPara* pMerged = static_cast<SwTextFrame*>(pFrame)->GetMergedPara()) + { + rIndex = pMerged->pFirstNode->GetIndex(); + } + } } } else if (rIndex.GetNode().IsEndNode()) @@ -1473,7 +1478,13 @@ GotoNextLayoutTextFrame(SwNodeIndex & rIndex, SwRootFrame const*const pLayout) { if (rIndex.GetNode().GetRedlineMergeFlag() != SwNode::Merge::None) { - rIndex = *static_cast<SwTextFrame*>(rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout))->GetMergedPara()->pLastNode; + if (SwContentFrame* pFrame = rIndex.GetNode().GetTextNode()->getLayoutFrame(pLayout)) + { + if (sw::MergedPara* pMerged = static_cast<SwTextFrame*>(pFrame)->GetMergedPara()) + { + rIndex = pMerged->pLastNode->GetIndex(); + } + } } } else if (rIndex.GetNode().IsTableNode())