From bf65f31c5fcd61d8c3aed0e7c6efc38dd7342c1f Mon Sep 17 00:00:00 2001 From: Jean Chalard <jchalard@google.com> Date: Tue, 17 May 2011 22:32:19 +0900 Subject: [PATCH] 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 --- .../inputmethod/latin/BinaryDictionaryGetter.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java index 562580d413..7ce92920d6 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryGetter.java @@ -78,16 +78,20 @@ class BinaryDictionaryGetter { } else { try { // 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) { Log.e(TAG, "Unable to create dictionary file from provider for locale " + locale.toString() + ": falling back to internal dictionary"); - return Arrays.asList(loadFallbackResource(context, fallbackResId)); } catch (IOException e) { Log.e(TAG, "Unable to read source data for locale " + locale.toString() + ": falling back to internal dictionary"); - return Arrays.asList(loadFallbackResource(context, fallbackResId)); } + return Arrays.asList(loadFallbackResource(context, fallbackResId)); } } } -- GitLab