am bdbefac0: am 263749f2: am 37deb112: Fix IndexOutOfBoundsException

* commit 'bdbefac0b471e8a70c5d4958b8d1a345777d6bdb':
  Fix IndexOutOfBoundsException
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index e5ed2da..a838102 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -349,8 +349,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);
@@ -359,8 +361,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 {