Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bf65f31c authored by Jean Chalard's avatar Jean Chalard
Browse files

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
parent d2d21ce0
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -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));
        }
    }
}