Fix IndexOutOfBound exception

Bug: 5011243
Change-Id: Iaaafa50b42e5155e3682132217d3e079a170ed89
main
Tadashi G. Takaoka 2011-07-13 17:25:25 -07:00
parent 787945bf1e
commit 41c1f48028
1 changed files with 6 additions and 1 deletions

View File

@ -245,7 +245,12 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
mTexts.clear();
for (int i = 0; i < count; i++) {
final CharSequence suggestion = suggestions.getWord(i);
if (suggestion == null) continue;
if (suggestion == null) {
// Skip an empty suggestion, but we need to add a place-holder for it in order
// to avoid an exception in the loop in updateSuggestions().
mTexts.add("");
continue;
}
final boolean isAutoCorrect = suggestions.mHasMinimalSuggestion
&& ((i == 1 && !suggestions.mTypedWordValid)