Skip to content
Snippets Groups Projects
Commit 1616e2e9 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Fix an excessive fallback problem."

parents c84bc346 0ee3b694
No related branches found
No related tags found
No related merge requests found
......@@ -64,24 +64,10 @@ public class DictionaryFactory {
}
}
// null == dictList is not supposed to be possible, but better safe than sorry and it's
// safer for future extension. In this case, rather than returning null, it should be safer
// to return an empty DictionaryCollection.
if (null == dictList) {
return new DictionaryCollection();
} else {
if (dictList.isEmpty()) {
// The list may be empty if no dictionaries have been added. The getter should not
// return an empty list, but if it does we end up here. Likewise, if the files
// we found could not be opened by the native code for any reason (format mismatch,
// file too big to fit in memory, etc) then we could have an empty list. In this
// case we want to fall back on the resource.
return new DictionaryCollection(createBinaryDictionary(context, fallbackResId,
locale));
} else {
return new DictionaryCollection(dictList);
}
}
// If the list is empty, that means we should not use any dictionary (for example, the user
// explicitly disabled the main dictionary), so the following is okay. dictList is never
// null, but if for some reason it is, DictionaryCollection handles it gracefully.
return new DictionaryCollection(dictList);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment