From e57d77cb01d3e76a942c5e2bb896135dd900f807 Mon Sep 17 00:00:00 2001 From: László Németh Date: Sat, 12 Dec 2020 13:19:01 +0100 Subject: tdf#138605 sw change tracking: fix crash with Undo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression from commit 469f472fb31c4ef1a57f8ec54ba750c1332feec2 (tdf#138479 tdf#137769 sw ChangesInMargin: fix Undo in paragraphs) Change-Id: I7826b7920e51733da98c00bfdcb8636d42655afc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107637 Tested-by: Jenkins Reviewed-by: László Németh --- sw/source/core/undo/unredln.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sw/source/core/undo') diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 6865beba6cd6..a737863c3835 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -93,15 +93,15 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) // fix PaM for deletions shown in margin bool bIsDeletion = dynamic_cast(this); + const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); sal_uInt32 nMaxId = SAL_MAX_UINT32; - if ( bIsDeletion ) + if ( bIsDeletion && rTable.size() > 0 ) { // Nodes of the deletion range are in the newest invisible redlines. // Set all redlines visible and recover the original deletion range. - for (sal_uInt32 nNodes = 0; nNodes < m_nEndNode - m_nSttNode + 1; ++ nNodes) + for (sal_uInt32 nNodes = 0; nNodes < m_nEndNode - m_nSttNode + 1; ++nNodes) { SwRedlineTable::size_type nCurRedlinePos = 0; - const SwRedlineTable& rTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable(); SwRangeRedline * pRedline(rTable[nCurRedlinePos]); // search last but nNodes redline by its nth biggest id -- cgit