Fix: NPE in DistracterFilter

Change-Id: I19a92d79cf547aae8f15e7e5fd5309812ae4f2d5
This commit is contained in:
Keisuke Kuroyanagi 2014-05-22 16:33:45 +09:00
parent 5e2c4c0297
commit 9218c51129

View file

@ -77,14 +77,16 @@ public class DistracterFilter {
public DistracterFilter(final Context context, final List<InputMethodSubtype> enabledSubtypes) { public DistracterFilter(final Context context, final List<InputMethodSubtype> enabledSubtypes) {
mContext = context; mContext = context;
mLocaleToSubtypeMap = new HashMap<>(); mLocaleToSubtypeMap = new HashMap<>();
for (final InputMethodSubtype subtype : enabledSubtypes) { if (enabledSubtypes != null) {
final Locale locale = SubtypeLocaleUtils.getSubtypeLocale(subtype); for (final InputMethodSubtype subtype : enabledSubtypes) {
if (mLocaleToSubtypeMap.containsKey(locale)) { final Locale locale = SubtypeLocaleUtils.getSubtypeLocale(subtype);
// Multiple subtypes are enabled for one locale. if (mLocaleToSubtypeMap.containsKey(locale)) {
// TODO: Investigate what we should do for this case. // Multiple subtypes are enabled for one locale.
continue; // TODO: Investigate what we should do for this case.
continue;
}
mLocaleToSubtypeMap.put(locale, subtype);
} }
mLocaleToSubtypeMap.put(locale, subtype);
} }
mLocaleToKeyboardMap = new HashMap<>(); mLocaleToKeyboardMap = new HashMap<>();
mSuggest = new Suggest(); mSuggest = new Suggest();