diff options
author | 2012-10-02 22:43:13 -0700 | |
---|---|---|
committer | 2012-10-02 22:43:13 -0700 | |
commit | 4d009dbc514cd77eb22e4162e4ae7ea852e1b77e (patch) | |
tree | 4ffba8ea02830105f386734a431e7f0565c51587 /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 2d1bdcf6d591a3014b6ee5c583246ae3fd9603eb (diff) | |
parent | ace7d1285dc1d4ba42d4f767698c5b6078ecbac2 (diff) | |
download | latinime-4d009dbc514cd77eb22e4162e4ae7ea852e1b77e.tar.gz latinime-4d009dbc514cd77eb22e4162e4ae7ea852e1b77e.tar.xz latinime-4d009dbc514cd77eb22e4162e4ae7ea852e1b77e.zip |
am ace7d128: am d445b56c: Fix possible NPE caused while monkey test
* commit 'ace7d1285dc1d4ba42d4f767698c5b6078ecbac2':
Fix possible NPE caused while monkey test
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 311355374..fe6ad4901 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1910,6 +1910,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction } private SuggestedWords getSuggestedWords(final int sessionId) { + final Keyboard keyboard = mKeyboardSwitcher.getKeyboard(); + if (keyboard == null) { + return SuggestedWords.EMPTY; + } final String typedWord = mWordComposer.getTypedWord(); // Get the word on which we should search the bigrams. If we are composing a word, it's // whatever is *before* the half-committed word in the buffer, hence 2; if we aren't, we @@ -1919,8 +1923,8 @@ public final class LatinIME extends InputMethodService implements KeyboardAction mConnection.getNthPreviousWord(mCurrentSettings.mWordSeparators, mWordComposer.isComposingWord() ? 2 : 1); final SuggestedWords suggestedWords = mSuggest.getSuggestedWords(mWordComposer, - prevWord, mKeyboardSwitcher.getKeyboard().getProximityInfo(), - mCurrentSettings.mCorrectionEnabled, sessionId); + prevWord, keyboard.getProximityInfo(), mCurrentSettings.mCorrectionEnabled, + sessionId); return maybeRetrieveOlderSuggestions(typedWord, suggestedWords); } |