aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-01-19 10:40:07 +0900
committerJean Chalard <jchalard@google.com>2012-01-19 12:06:00 +0900
commitaf480be66ee0c859828077a01d6bc096f7349c17 (patch)
tree5c7a50524ed6e2bca22455c03d58509e2ff1dc3b /java/src
parentcc6ded7a1afc8ff8fe0e34e77d0ec3f68a858f97 (diff)
downloadlatinime-af480be66ee0c859828077a01d6bc096f7349c17.tar.gz
latinime-af480be66ee0c859828077a01d6bc096f7349c17.tar.xz
latinime-af480be66ee0c859828077a01d6bc096f7349c17.zip
Squash a ridiculously improbable NPE
This probably can't be triggered by anything that is not a monkey, but still, let's fix this Bug: 5797549 Change-Id: I9a7d9fd6664c97787ce676a28675e96f46df7658
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/AutoCorrection.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java
index e5eb15938..bcb78919d 100644
--- a/java/src/com/android/inputmethod/latin/AutoCorrection.java
+++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java
@@ -74,6 +74,14 @@ public class AutoCorrection {
for (final String key : dictionaries.keySet()) {
if (key.equals(Suggest.DICT_KEY_WHITELIST)) continue;
final Dictionary dictionary = dictionaries.get(key);
+ // It's unclear how realistically 'dictionary' can be null, but the monkey is somehow
+ // managing to get null in here. Presumably the language is changing to a language with
+ // no main dictionary and the monkey manages to type a whole word before the thread
+ // that reads the dictionary is started or something?
+ // Ideally the passed map would come out of a {@link java.util.concurrent.Future} and
+ // would be immutable once it's finished initializing, but concretely a null test is
+ // probably good enough for the time being.
+ if (null == dictionary) continue;
if (dictionary.isValidWord(word)
|| (ignoreCase && dictionary.isValidWord(lowerCasedWord))) {
return true;