Add a check for invalid spans being set by SpellChecker.

One of the exit conditions of the loop immediately above the code is
when a BreakIterator finishes its input and emits BreakIterator.DONE,
which we were then mistakenly then using as a parameter for setting
spans.

Bug: 12936072
Bug: 5555929
Change-Id: Ib4aba113f2e7838cd040076160c1dd0fb90adb1a
This commit is contained in:
Roozbeh Pournader
2015-03-11 11:09:34 -07:00
parent 5f035052b6
commit 4cdeeadd42

View File

@@ -727,14 +727,10 @@ public class SpellChecker implements SpellCheckerSessionListener {
}
}
if (scheduleOtherSpellCheck && wordStart <= end) {
if (scheduleOtherSpellCheck && wordStart != BreakIterator.DONE && wordStart <= end) {
// Update range span: start new spell check from last wordStart
setRangeSpan(editable, wordStart, end);
} else {
if (DBG && scheduleOtherSpellCheck) {
Log.w(TAG, "Trying to schedule spellcheck for invalid region, from "
+ wordStart + " to " + end);
}
removeRangeSpan(editable);
}