am 263749f2: am 37deb112: Fix IndexOutOfBoundsException

* commit '263749f2dc5d1cb885786afbccbb19ae6847c204':
  Fix IndexOutOfBoundsException
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index 5719b90..c52f6b2 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -332,8 +332,10 @@
 
     @Override
     public boolean onLongClick(View view) {
-        int index = (Integer) view.getTag();
-        CharSequence word = mSuggestions.getWord(index);
+        final int index = (Integer) view.getTag();
+        if (index >= mSuggestions.size())
+            return true;
+        final CharSequence word = mSuggestions.getWord(index);
         if (word.length() < 2)
             return false;
         addToDictionary(word);
@@ -342,8 +344,10 @@
 
     @Override
     public void onClick(View view) {
-        int index = (Integer) view.getTag();
-        CharSequence word = mSuggestions.getWord(index);
+        final int index = (Integer) view.getTag();
+        if (index >= mSuggestions.size())
+            return;
+        final CharSequence word = mSuggestions.getWord(index);
         if (mShowingAddToDictionary && index == 0) {
             addToDictionary(word);
         } else {