sw/source/core/doc/docnum.cxx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
New commits: commit d77beaf8bcae20ac72193a0ba767b4a199258dbc Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri May 19 10:49:28 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon May 22 11:08:10 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 (cherry picked from commit 4269977853bd51c4fc7f93e497246da163d71f17) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152030 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index b4d32ea25b61..703c15f2187d 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1439,11 +1439,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()) @@ -1471,7 +1476,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())