work around NPE by defaulting to English

Somehow getLangIsoCode() is returning null when called early in app
launch, on some subset of devices the Play Store isn't
identifying. I'm just going to default to "en" when that happens.
This commit is contained in:
Eric House 2022-08-20 10:10:41 -07:00
parent 4ab88eb572
commit bab96c4528

View file

@ -54,6 +54,9 @@ public class DictListPreference extends XWListPreference {
curLang = LocUtils.getString( context, R.string.lang_name_english );
}
ISOCode isoCode = DictLangCache.getLangIsoCode( context, curLang );
if ( null == isoCode ) { // work around crash reported via Play Store
isoCode = Utils.ISO_EN;
}
DictUtils.DictAndLoc[] dals = DictUtils.dictList( context );
ArrayList<String> dictEntries = new ArrayList<>();