fix the end point of span exceeds the length of SpannableStringBuilder

This commit is contained in:
xufuji456 2020-10-29 15:12:49 +08:00
parent af4028f30e
commit 4bc392a8ef

View file

@ -185,6 +185,9 @@ public final class Tx3gDecoder extends SimpleSubtitleDecoder {
int fontFace = parsableByteArray.readUnsignedByte();
parsableByteArray.skipBytes(1); // font size
int colorRgba = parsableByteArray.readInt();
if (end > cueText.length()) {
end = cueText.length();
}
attachFontFace(cueText, fontFace, defaultFontFace, start, end, SPAN_PRIORITY_HIGH);
attachColor(cueText, colorRgba, defaultColorRgba, start, end, SPAN_PRIORITY_HIGH);
}