From 255c044b0e7632e3bb8bb85ea0672425f30a3a88 Mon Sep 17 00:00:00 2001
From: Ken Wakasa <kwakasa@google.com>
Date: Sun, 9 Jan 2011 18:44:28 +0900
Subject: [PATCH] Fix StringIndexOutOfBoundsException

bug: 3325065
Change-Id: Ic3d2dca5b2aa1681d472c7f96b31737e15f4952d
---
 .../com/android/inputmethod/latin/ExpandableDictionary.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
index bc08df0423..0fc86c3352 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
@@ -146,7 +146,7 @@ public class ExpandableDictionary extends Dictionary {
     public Context getContext() {
         return mContext;
     }
-    
+
     public int getMaxWordLength() {
         return MAX_WORD_LENGTH;
     }
@@ -158,6 +158,7 @@ public class ExpandableDictionary extends Dictionary {
     private void addWordRec(NodeArray children, final String word, final int depth,
             final int frequency, Node parentNode) {
         final int wordLength = word.length();
+        if (wordLength <= depth) return;
         final char c = word.charAt(depth);
         // Does children have the current character?
         final int childrenLength = children.mLength;
-- 
GitLab