Fix a StringIndexOutOfBounds. Bug: 2524050
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 70d49f5..dc6be43 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1468,7 +1468,7 @@
             mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS);
             updateSuggestions();
         }
-        if (mBestWord != null) {
+        if (mBestWord != null && mBestWord.length() > 0) {
             TextEntryState.acceptedDefault(mWord.getTypedWord(), mBestWord);
             mJustAccepted = true;
             pickSuggestion(mBestWord);