aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-08-03 07:22:09 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-08-03 07:22:09 -0700
commit3695f4be479df2d73a101da03cac76992ee2cb28 (patch)
tree5c673145cabf0d9a4421955946390f5f1cde2938 /java/src
parentcc2ae5e24bb6951265fb43915eba738bb5a84681 (diff)
parent53f4acf86f6d330146af72f3688ad71428cb8bb6 (diff)
downloadlatinime-3695f4be479df2d73a101da03cac76992ee2cb28.tar.gz
latinime-3695f4be479df2d73a101da03cac76992ee2cb28.tar.xz
latinime-3695f4be479df2d73a101da03cac76992ee2cb28.zip
am 53f4acf8: am 3f805418: Merge "Fix an OOB exception" into jb-mr1-dev
* commit '53f4acf86f6d330146af72f3688ad71428cb8bb6': Fix an OOB exception
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableDictionary.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
index 5d7995dc2..d101aaf15 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
@@ -654,9 +654,12 @@ public class ExpandableDictionary extends Dictionary {
--index;
mLookedUpString[index] = node.mCode;
node = node.mParent;
- } while (node != null);
+ } while (node != null && index > 0);
- if (freq >= 0) {
+ // If node is null, we have a word longer than MAX_WORD_LENGTH in the dictionary.
+ // It's a little unclear how this can happen, but just in case it does it's safer
+ // to ignore the word in this case.
+ if (freq >= 0 && node == null) {
suggestions.add(new SuggestedWordInfo(new String(mLookedUpString, index,
BinaryDictionary.MAX_WORD_LENGTH - index),
freq, SuggestedWordInfo.KIND_CORRECTION, mDictType));