From d6e3494421dff2a091f1011e5266b280b2109843 Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Fri, 26 Aug 2011 10:13:15 -0700 Subject: [PATCH] Bug 5218421. Spell check crash with Japanese characters The word iterator returns no word in that case, and this is not supported by TextInfo. Change-Id: Iaf31c58638c02d3cdc7b88bc0d1201e793e84f17 --- core/java/android/widget/SpellChecker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java index 5e3b956e83a3a..ff13dcbf54f4c 100644 --- a/core/java/android/widget/SpellChecker.java +++ b/core/java/android/widget/SpellChecker.java @@ -142,7 +142,7 @@ public class SpellChecker implements SpellCheckerSessionListener { final int end = editable.getSpanEnd(spellCheckSpan); // Do not check this word if the user is currently editing it - if (start >= 0 && end >= 0 && (selectionEnd < start || selectionStart > end)) { + if (start >= 0 && end > start && (selectionEnd < start || selectionStart > end)) { final String word = editable.subSequence(start, end).toString(); spellCheckSpan.setSpellCheckInProgress(); textInfos[textInfosCount++] = new TextInfo(word, mCookie, mIds[i]);