aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/ExpandableDictionary.java
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2012-08-06 16:04:07 +0900
committerSatoshi Kataoka <satok@google.com>2012-08-06 16:04:07 +0900
commit44456dcbf23c29b54e9372d932b79805957724cb (patch)
treea8167c70e9d7017f212066cf2364d1ad5b09fdca /java/src/com/android/inputmethod/latin/ExpandableDictionary.java
parent07e4f9eb530a795efd97986e28546c8c5e895c72 (diff)
parentd299bde24b4afd3955fa65c7ab372807a336c6df (diff)
downloadlatinime-44456dcbf23c29b54e9372d932b79805957724cb.tar.gz
latinime-44456dcbf23c29b54e9372d932b79805957724cb.tar.xz
latinime-44456dcbf23c29b54e9372d932b79805957724cb.zip
Merge remote-tracking branch 'goog/master' into mergescriptpackage
Conflicts: java/res/values-af/strings.xml java/res/values-cs/strings.xml java/res/values-et/strings.xml java/res/values-fi/strings.xml java/res/values-hi/strings.xml java/res/values-hr/strings.xml java/res/values-hu/strings.xml java/res/values-in/strings.xml java/res/values-ja/strings.xml java/res/values-ko/strings.xml java/res/values-lt/strings.xml java/res/values-lv/strings.xml java/res/values-ms/strings.xml java/res/values-pt/strings.xml java/res/values-ro/strings.xml java/res/values-ru/strings.xml java/res/values-sk/strings.xml java/res/values-sl/strings.xml java/res/values-sr/strings.xml java/res/values-sw/strings.xml java/res/values-tr/strings.xml java/res/values-vi/strings.xml java/res/values-zh-rCN/strings.xml java/res/values-zh-rTW/strings.xml Change-Id: Ib4141aca0b35148d62d22d4f32309f890c84303a
Diffstat (limited to 'java/src/com/android/inputmethod/latin/ExpandableDictionary.java')
-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));