Skip to content

Commit

Permalink
fix: support encode styled string if length larger than offset (#3254)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Aug 7, 2023
1 parent 50226e5 commit 22d792e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,11 @@ private void decodeIterate(PeekingIterator<Span> it) {
}

// write encoded raw text preceding the closing tag
if (spanEnd > lastOffset) {
if (spanEnd > lastOffset && text.length() >= spanEnd) {
xmlValue.append(ResXmlEncoders.escapeXmlChars(text.substring(lastOffset, spanEnd)));
} else if (text.length() >= lastOffset && text.length() < spanEnd) {
LOGGER.warning("Span (" + name + ") exceeds text length " + text.length());
xmlValue.append(ResXmlEncoders.escapeXmlChars(text.substring(lastOffset)));
}
lastOffset = spanEnd;

Expand Down

0 comments on commit 22d792e

Please sign in to comment.