Don't exceed text length

This commit is contained in:
serso 2016-04-09 21:42:49 +02:00
parent b85d7d1658
commit 08bf51fd2a

View File

@ -174,7 +174,7 @@ public class TextHighlighter implements TextProcessor<TextProcessorEditorResult,
}
private int highlightGroup(SpannableStringBuilder sb, int start, int group, int groupsCount, @Nonnull List<GroupSpan> spans) {
final int end = fillGroupSpans(sb, start + 1, group, groupsCount, spans);
final int end = Math.min(sb.length(), fillGroupSpans(sb, start + 1, group, groupsCount, spans));
if (start + 1 < end) {
spans.add(new GroupSpan(start + 1, end, group));
}