am 0e66ab74: Merge "Fix ArrayIndexOutOfBoundException"

* commit '0e66ab743358b1ea65d93c640bf167af90b4d481':
  Fix ArrayIndexOutOfBoundException
main
Tadashi G. Takaoka 2013-06-03 00:13:35 -07:00 committed by Android Git Automerger
commit c6b7cd3524
1 changed files with 3 additions and 0 deletions

View File

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