From 109a573a644ab7aa760cde30538b1122155adc9f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 29 Nov 2018 14:50:20 +0100 Subject: sw_redlinehide_4a: fix asserts caused by invalid index in SwUpdateAttr There is no reason for SwpHints::TryInsertHint() to add 1 to the end index of an empty hint, which results in an invalid index when the end of the hint is at the end of the node. The only user of the indexes in SwUpdateAttr is SwTextFrame::SwClientNotify() and it already extends a 0 range to 1. Change-Id: I7355bac931cd8dd390f96d04546d73273f364cda --- sw/source/core/text/txtfrm.cxx | 3 +-- sw/source/core/txtnode/thints.cxx | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index b71e4c4b3863..db6b3d3b28df 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -2127,9 +2127,8 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint) if( IsIdxInside( nPos, nLen ) ) { // We need to reformat anyways, even if the invalidated - // area is NULL. + // range is empty. // E.g.: empty line, set 14 pt! - // if( !nLen ) nLen = 1; // FootnoteNumbers need to be formatted if( !nLen ) diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 83aa88513688..1d6860f4d959 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -3253,10 +3253,7 @@ bool SwpHints::TryInsertHint( // ... and notify listeners if ( rNode.HasWriterListeners() ) { - SwUpdateAttr aHint( - nHtStart, - nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd, - nWhich); + SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich); rNode.ModifyNotification( nullptr, &aHint ); } -- cgit