Fix a bug in one of the methods to get a dictionary.
One of the two methods for getting a dictionary from the dictionary pack had a bug and would not tolerate not getting an actual dictionary. This change fixes that. Change-Id: Id58bb27258494fb3aa60ec07a4eb27cfb5cc7279
This commit is contained in:
parent
d2d21ce0be
commit
bf65f31c5f
1 changed files with 7 additions and 3 deletions
|
@ -78,16 +78,20 @@ class BinaryDictionaryGetter {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
// If that was no-go, try to find a publicly exported dictionary.
|
// If that was no-go, try to find a publicly exported dictionary.
|
||||||
return BinaryDictionaryFileDumper.getDictSetFromContentProvider(locale, context);
|
List<AssetFileAddress> listFromContentProvider =
|
||||||
|
BinaryDictionaryFileDumper.getDictSetFromContentProvider(locale, context);
|
||||||
|
if (null != listFromContentProvider) {
|
||||||
|
return listFromContentProvider;
|
||||||
|
}
|
||||||
|
// If the list is null, fall through and return the fallback
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(TAG, "Unable to create dictionary file from provider for locale "
|
Log.e(TAG, "Unable to create dictionary file from provider for locale "
|
||||||
+ locale.toString() + ": falling back to internal dictionary");
|
+ locale.toString() + ": falling back to internal dictionary");
|
||||||
return Arrays.asList(loadFallbackResource(context, fallbackResId));
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "Unable to read source data for locale "
|
Log.e(TAG, "Unable to read source data for locale "
|
||||||
+ locale.toString() + ": falling back to internal dictionary");
|
+ locale.toString() + ": falling back to internal dictionary");
|
||||||
return Arrays.asList(loadFallbackResource(context, fallbackResId));
|
|
||||||
}
|
}
|
||||||
|
return Arrays.asList(loadFallbackResource(context, fallbackResId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue