From 08bf51fd2a3df34f45b95338a0ea2c9f17ba4166 Mon Sep 17 00:00:00 2001 From: serso Date: Sat, 9 Apr 2016 21:42:49 +0200 Subject: [PATCH] Don't exceed text length --- .../org/solovyev/android/calculator/view/TextHighlighter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java b/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java index 09e95ac5..dbf3a4fd 100644 --- a/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java +++ b/app/src/main/java/org/solovyev/android/calculator/view/TextHighlighter.java @@ -174,7 +174,7 @@ public class TextHighlighter implements TextProcessor 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)); }