Fix null pointer exception in LatinIME

Change-Id: Ic4d60fe651bdc83771137c0f61f07c3879a3f1a1
main
satok 2011-05-13 20:27:01 +09:00
parent 950def1df3
commit fe1a6d961c
1 changed files with 11 additions and 8 deletions

View File

@ -1465,15 +1465,18 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// in most cases, suggestion count is 1 when typed word's length is 1, but we do always
// need to clear the previous state when the user starts typing a word (i.e. typed word's
// length == 1).
if (typedWord != null) {
if (builder.size() > 1 || typedWord.length() == 1 || typedWordValid
|| mCandidateView.isShowingAddToDictionaryHint()) {
builder.setTypedWordValid(typedWordValid).setHasMinimalSuggestion(correctionAvailable);
builder.setTypedWordValid(typedWordValid).setHasMinimalSuggestion(
correctionAvailable);
} else {
final SuggestedWords previousSuggestions = mCandidateView.getSuggestions();
if (previousSuggestions == mSettingsValues.mSuggestPuncList)
return;
builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions);
}
}
showSuggestions(builder.build(), typedWord);
}