Merge "Fix an NPE"

This commit is contained in:
Jean Chalard 2011-09-09 02:18:11 -07:00 committed by Android (Google) Code Review
commit a40aba0022

View file

@ -1875,15 +1875,17 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
return; return;
} }
if (null != mSuggest && null != mUserUnigramDictionary) {
final boolean selectedATypedWordAndItsInUserUnigramDic = final boolean selectedATypedWordAndItsInUserUnigramDic =
!selectedANotTypedWord && mUserUnigramDictionary.isValidWord(suggestion); !selectedANotTypedWord && mUserUnigramDictionary.isValidWord(suggestion);
final boolean isValidWord = AutoCorrection.isValidWord( final boolean isValidWord = AutoCorrection.isValidWord(
mSuggest.getUnigramDictionaries(), suggestion, true); mSuggest.getUnigramDictionaries(), suggestion, true);
final boolean needsToAddToUserUnigramDictionary = selectedATypedWordAndItsInUserUnigramDic final boolean needsToAddToUserUnigramDictionary =
|| !isValidWord; selectedATypedWordAndItsInUserUnigramDic || !isValidWord;
if (needsToAddToUserUnigramDictionary) { if (needsToAddToUserUnigramDictionary) {
mUserUnigramDictionary.addWord(suggestion.toString(), frequencyDelta); mUserUnigramDictionary.addWord(suggestion.toString(), frequencyDelta);
} }
}
if (mUserBigramDictionary != null) { if (mUserBigramDictionary != null) {
// We don't want to register as bigrams words separated by a separator. // We don't want to register as bigrams words separated by a separator.