Fix out of bounds exception for bad fallback spans

(cherry picked from commit 8f7dbd85688cc1f0df9477c39322784a1be322ff)
This commit is contained in:
Stephen Paul Weber 2024-10-03 10:48:53 -05:00 committed by Arne
parent 8644c74935
commit 293c21db2c

View file

@ -622,7 +622,9 @@ public class MessageParser extends AbstractParser implements Consumer<im.convers
if (span.getAttribute("start") == null || span.getAttribute("end") == null) {
bodyB.setLength(0);
} else {
bodyB.delete(bodyB.offsetByCodePoints(0, parseInt(span.getAttribute("start"))), bodyB.offsetByCodePoints(0, parseInt(span.getAttribute("end"))));
try {
bodyB.delete(bodyB.offsetByCodePoints(0, parseInt(span.getAttribute("start"))), bodyB.offsetByCodePoints(0, parseInt(span.getAttribute("end"))));
} catch (final IndexOutOfBoundsException e) { /* bad span */ }
}
}
}