Merge "Fix null pointer exception in LatinIME"

This commit is contained in:
satok 2011-05-13 04:43:47 -07:00 committed by Android (Google) Code Review
commit 7f3674af5a

View file

@ -1465,14 +1465,17 @@ 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 // 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 // need to clear the previous state when the user starts typing a word (i.e. typed word's
// length == 1). // length == 1).
if (builder.size() > 1 || typedWord.length() == 1 || typedWordValid if (typedWord != null) {
|| mCandidateView.isShowingAddToDictionaryHint()) { if (builder.size() > 1 || typedWord.length() == 1 || typedWordValid
builder.setTypedWordValid(typedWordValid).setHasMinimalSuggestion(correctionAvailable); || mCandidateView.isShowingAddToDictionaryHint()) {
} else { builder.setTypedWordValid(typedWordValid).setHasMinimalSuggestion(
final SuggestedWords previousSuggestions = mCandidateView.getSuggestions(); correctionAvailable);
if (previousSuggestions == mSettingsValues.mSuggestPuncList) } else {
return; final SuggestedWords previousSuggestions = mCandidateView.getSuggestions();
builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions); if (previousSuggestions == mSettingsValues.mSuggestPuncList)
return;
builder.addTypedWordAndPreviousSuggestions(typedWord, previousSuggestions);
}
} }
showSuggestions(builder.build(), typedWord); showSuggestions(builder.build(), typedWord);
} }