diff options
author | 2014-11-20 14:35:39 +0900 | |
---|---|---|
committer | 2014-11-20 14:48:33 +0900 | |
commit | a94733cbca5bc3544fa73fa1649bbb1dadf31356 (patch) | |
tree | fc3e5c5a0ac3986b71870a6a6042e6bb8db5b20c /java/src/com/android/inputmethod | |
parent | 1d80cb230180305a173add2fe30b14cefc597126 (diff) | |
download | latinime-a94733cbca5bc3544fa73fa1649bbb1dadf31356.tar.gz latinime-a94733cbca5bc3544fa73fa1649bbb1dadf31356.tar.xz latinime-a94733cbca5bc3544fa73fa1649bbb1dadf31356.zip |
Fix an NPE.
Change-Id: Ie5ab5cc716ef1211eb9ad76baa0467455e1f1a71
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r-- | java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java | 10 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java index 2762a9f25..b0072eebe 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java @@ -152,12 +152,16 @@ public final class AccessibilityUtils { * will occur when a key is typed. * * @param suggestedWords the list of suggested auto-correction words - * @param typedWord the currently typed word */ - public void setAutoCorrection(final SuggestedWords suggestedWords, final String typedWord) { + public void setAutoCorrection(final SuggestedWords suggestedWords) { if (suggestedWords.mWillAutoCorrect) { mAutoCorrectionWord = suggestedWords.getWord(SuggestedWords.INDEX_OF_AUTO_CORRECTION); - mTypedWord = typedWord; + final SuggestedWords.SuggestedWordInfo typedWordInfo = suggestedWords.mTypedWordInfo; + if (null == typedWordInfo) { + mTypedWord = null; + } else { + mTypedWord = typedWordInfo.mWord; + } } else { mAutoCorrectionWord = null; mTypedWord = null; diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6411010e6..7b7b6d35e 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1637,8 +1637,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen } // Cache the auto-correction in accessibility code so we can speak it if the user // touches a key that will insert it. - AccessibilityUtils.getInstance().setAutoCorrection(suggestedWords, - suggestedWords.mTypedWordInfo.mWord); + AccessibilityUtils.getInstance().setAutoCorrection(suggestedWords); } // Called from {@link SuggestionStripView} through the {@link SuggestionStripView#Listener} |