Merge "Fix spell checker framework"
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index 92c2e6e..4f700a2 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -290,7 +290,7 @@
 
     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 @@
 
         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(