Merge "Fix ArrayIndexOutOfBoundException"

main
Tadashi G. Takaoka 2013-06-03 07:12:06 +00:00 committed by Android (Google) Code Review
commit 0e66ab7433
1 changed files with 3 additions and 0 deletions

View File

@ -208,6 +208,9 @@ final class SuggestionStripLayoutHelper {
private CharSequence getStyledSuggestedWord(final SuggestedWords suggestedWords, private CharSequence getStyledSuggestedWord(final SuggestedWords suggestedWords,
final int indexInSuggestedWords) { final int indexInSuggestedWords) {
if (indexInSuggestedWords >= suggestedWords.size()) {
return null;
}
final String word = suggestedWords.getWord(indexInSuggestedWords); final String word = suggestedWords.getWord(indexInSuggestedWords);
final boolean isAutoCorrect = indexInSuggestedWords == 1 final boolean isAutoCorrect = indexInSuggestedWords == 1
&& suggestedWords.willAutoCorrect(); && suggestedWords.willAutoCorrect();