Skip to content
Snippets Groups Projects
Commit 37deb112 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Fix IndexOutOfBoundsException

Bug: 4586181
Change-Id: I10a2d1486c9a0d11aa42cf7c6a33ecd70b6918d7
parent 98275e45
No related branches found
No related tags found
No related merge requests found
...@@ -332,8 +332,10 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo ...@@ -332,8 +332,10 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
@Override @Override
public boolean onLongClick(View view) { public boolean onLongClick(View view) {
int index = (Integer) view.getTag(); final int index = (Integer) view.getTag();
CharSequence word = mSuggestions.getWord(index); if (index >= mSuggestions.size())
return true;
final CharSequence word = mSuggestions.getWord(index);
if (word.length() < 2) if (word.length() < 2)
return false; return false;
addToDictionary(word); addToDictionary(word);
...@@ -342,8 +344,10 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo ...@@ -342,8 +344,10 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
@Override @Override
public void onClick(View view) { public void onClick(View view) {
int index = (Integer) view.getTag(); final int index = (Integer) view.getTag();
CharSequence word = mSuggestions.getWord(index); if (index >= mSuggestions.size())
return;
final CharSequence word = mSuggestions.getWord(index);
if (mShowingAddToDictionary && index == 0) { if (mShowingAddToDictionary && index == 0) {
addToDictionary(word); addToDictionary(word);
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment