Added fail-safe

This commit is contained in:
M66B 2022-05-03 13:17:29 +02:00
parent 83cb57b006
commit ce5499e91f
1 changed files with 2 additions and 1 deletions

View File

@ -959,7 +959,8 @@ public class StyleHelper {
static void markAsInserted(Editable text, int start, int end) {
for (InsertedSpan span : text.getSpans(0, text.length(), InsertedSpan.class))
text.removeSpan(span);
text.setSpan(new InsertedSpan(), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
if (start >= 0 && start < end && end <= text.length())
text.setSpan(new InsertedSpan(), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
static class InsertedSpan implements NoCopySpan {