Avoid NPE by checking
Bug: 11956240 Change-Id: I3de1ebbf96fa2422124e4d8e50190adfa09b8a49
This commit is contained in:
parent
75eb9c8934
commit
9a0216def9
1 changed files with 3 additions and 0 deletions
|
@ -71,6 +71,9 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
|||
// Because the "%s" summary trick of {@link ListPreference} doesn't work properly before
|
||||
// KitKat, we need to update the summary programmatically.
|
||||
final ListPreference listPreference = (ListPreference)findPreference(prefKey);
|
||||
if (listPreference == null) {
|
||||
return;
|
||||
}
|
||||
final CharSequence entries[] = listPreference.getEntries();
|
||||
final int entryIndex = listPreference.findIndexOfValue(listPreference.getValue());
|
||||
listPreference.setSummary(entryIndex < 0 ? null : entries[entryIndex]);
|
||||
|
|
Loading…
Reference in a new issue