[Libreoffice-commits] core.git: sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 20 10:02:54 UTC 2020


 sw/source/core/tox/ToxWhitespaceStripper.cxx |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit ae56432d7e34529cd5ad391f074737d3f5adf137
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jan 17 19:16:48 2020 +0100
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Jan 20 11:02:23 2020 +0100

    sw: fix assert in ToX update on mw00_table_of_contents_templates.doc
    
    ... exported to RTF and re-imported:
    
    soffice.bin: sw/source/core/txtnode/thints.cxx:1295: bool SwTextNode::InsertHint(SwTextAttr*, SetAttrMode): Assertion `!pAttr->GetEnd() || (*pAttr->GetEnd() <= Len())' failed.
    
    The problem is that the text of a HandledTextToken is all whitespace and
    a hint from 0 to 1 is inserted because mNewPositions.back() is
    erroneously 1, no idea why it was doing that.
    
    (regression from e5345f62bf525b6258736f1ce11a61b5e638e0ff)
    
    Change-Id: I6ec290abe50c0f65a3244f0f0bb07e19741e878b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86996
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/sw/source/core/tox/ToxWhitespaceStripper.cxx b/sw/source/core/tox/ToxWhitespaceStripper.cxx
index fb9315862d6e..fc51a94c2e33 100644
--- a/sw/source/core/tox/ToxWhitespaceStripper.cxx
+++ b/sw/source/core/tox/ToxWhitespaceStripper.cxx
@@ -36,13 +36,11 @@ ToxWhitespaceStripper::ToxWhitespaceStripper(const OUString& inputString)
         }
         mNewPositions.push_back(buffer.getLength()-1);
     }
-    // Add one position if the position after the stripped string is requested, e.g., for attributes which
-    // extend beyond the string.
-    mNewPositions.push_back(buffer.getLength());
     // strip the last whitespace (if there was one)
     if (lastCharacterWasWhitespace) {
         buffer.truncate(buffer.getLength() - 1);
     }
+    mNewPositions.push_back(buffer.getLength());
     mStripped = buffer.getStr();
 }
 


More information about the Libreoffice-commits mailing list