aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorMohammadinamul Sheik <inamul@google.com>2015-02-24 23:57:21 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-24 23:57:21 +0000
commit85c78f712452e879d9d3971ca38d39e0d024ea62 (patch)
treea7db07d17f26977de945c635986e8dade9126347 /java
parent3c0997c961c696f73cfb2556f8b8f60103905c61 (diff)
parent24c282437dd7dd4b135e3410b5459ca83d304524 (diff)
downloadlatinime-85c78f712452e879d9d3971ca38d39e0d024ea62.tar.gz
latinime-85c78f712452e879d9d3971ca38d39e0d024ea62.tar.xz
latinime-85c78f712452e879d9d3971ca38d39e0d024ea62.zip
am 24c28243: Do not crash when dictioanryInfo is NULL
* commit '24c282437dd7dd4b135e3410b5459ca83d304524': Do not crash when dictioanryInfo is NULL
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
index 6734ca8c5..293623cae 100644
--- a/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/DictionaryInfoUtils.java
@@ -359,8 +359,11 @@ public class DictionaryInfoUtils {
* @param fileAddress the asset dictionary file address.
* @return information of the specified dictionary.
*/
+ @Nullable
private static DictionaryInfo createDictionaryInfoFromFileAddress(
final AssetFileAddress fileAddress) {
+ // TODO: Read the header and update the version number for the new dictionaries.
+ // This will make sure that the dictionary version is updated in the database.
final DictionaryHeader header = getDictionaryFileHeaderOrNull(
new File(fileAddress.mFilename), fileAddress.mOffset, fileAddress.mLength);
if (header == null) {
@@ -436,7 +439,8 @@ public class DictionaryInfoUtils {
// Protect against cases of a less-specific dictionary being found, like an
// en dictionary being used for an en_US locale. In this case, the en dictionary
// should be used for en_US but discounted for listing purposes.
- if (!dictionaryInfo.mLocale.equals(locale)) {
+ // TODO: Remove dictionaryInfo == null when the static LMs have the headers.
+ if (dictionaryInfo == null || !dictionaryInfo.mLocale.equals(locale)) {
continue;
}
addOrUpdateDictInfo(dictList, dictionaryInfo);