summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-03-08 17:03:48 +0900
committersatok <satok@google.com>2012-03-08 17:03:48 +0900
commit792ee0cc4d9415e45a16803c6fe3e60c53760e25 (patch)
tree290a3677710f7c88e689104f19082e0d253b5da5 /core
parent0de2ed3bf355fd92bcb3c169895a29c9c3db745a (diff)
downloadframeworks_base-792ee0cc4d9415e45a16803c6fe3e60c53760e25.zip
frameworks_base-792ee0cc4d9415e45a16803c6fe3e60c53760e25.tar.gz
frameworks_base-792ee0cc4d9415e45a16803c6fe3e60c53760e25.tar.bz2
Fix possible NPE in SpellChecker
Change-Id: Ib3c9fe7189c8f31a460149add857e9855919f386
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/SpellChecker.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index df2996c..a24faab 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -290,7 +290,7 @@ public class SpellChecker implements SpellCheckerSessionListener {
private SpellCheckSpan onGetSuggestionsInternal(
SuggestionsInfo suggestionsInfo, int offset, int length) {
- if (suggestionsInfo.getCookie() != mCookie) {
+ if (suggestionsInfo == null || suggestionsInfo.getCookie() != mCookie) {
return null;
}
final Editable editable = (Editable) mTextView.getText();
@@ -335,9 +335,15 @@ public class SpellChecker implements SpellCheckerSessionListener {
for (int i = 0; i < results.length; ++i) {
final SentenceSuggestionsInfo ssi = results[i];
+ if (ssi == null) {
+ continue;
+ }
SpellCheckSpan spellCheckSpan = null;
for (int j = 0; j < ssi.getSuggestionsCount(); ++j) {
final SuggestionsInfo suggestionsInfo = ssi.getSuggestionsInfoAt(j);
+ if (suggestionsInfo == null) {
+ continue;
+ }
final int offset = ssi.getOffsetAt(j);
final int length = ssi.getLengthAt(j);
final SpellCheckSpan scs = onGetSuggestionsInternal(