am 35e9a7ac: Merge "Squash a ridiculously improbable NPE"

* commit '35e9a7ac553b4853b1b01642d2d8ab76f22dc5b0':
  Squash a ridiculously improbable NPE
main
Jean Chalard 2012-01-22 18:39:50 -08:00 committed by Android Git Automerger
commit 18a5d1f1fb
1 changed files with 8 additions and 0 deletions

View File

@ -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;