diff options
author | Amith Yamasani <yamasani@google.com> | 2012-10-22 16:38:02 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2012-10-22 16:38:02 -0700 |
commit | 64516a191f03a777896798f79792d39cde9592d7 (patch) | |
tree | 0deb4fee19114fd6a55976d53b77dc620ecf82f3 /src/com/android/settings | |
parent | 56a166e9e3cac96246bd724ceea96846fc9e41e1 (diff) | |
download | packages_apps_settings-64516a191f03a777896798f79792d39cde9592d7.zip packages_apps_settings-64516a191f03a777896798f79792d39cde9592d7.tar.gz packages_apps_settings-64516a191f03a777896798f79792d39cde9592d7.tar.bz2 |
Fixes an AIOOBE when device admin enforces a small timeout for screen lock
Bug: 7378871
If the timeout choices are empty, set an empty summary.
Change-Id: I20dbe61af56f9c41337a7c284580511322e5a45e
Diffstat (limited to 'src/com/android/settings')
-rw-r--r-- | src/com/android/settings/DisplaySettings.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java index 9f812fe..fb839a7 100644 --- a/src/com/android/settings/DisplaySettings.java +++ b/src/com/android/settings/DisplaySettings.java @@ -154,15 +154,19 @@ public class DisplaySettings extends SettingsPreferenceFragment implements } else { final CharSequence[] entries = preference.getEntries(); final CharSequence[] values = preference.getEntryValues(); - int best = 0; - for (int i = 0; i < values.length; i++) { - long timeout = Long.parseLong(values[i].toString()); - if (currentTimeout >= timeout) { - best = i; + if (entries == null || entries.length == 0) { + summary = ""; + } else { + int best = 0; + for (int i = 0; i < values.length; i++) { + long timeout = Long.parseLong(values[i].toString()); + if (currentTimeout >= timeout) { + best = i; + } } + summary = preference.getContext().getString(R.string.screen_timeout_summary, + entries[best]); } - summary = preference.getContext().getString(R.string.screen_timeout_summary, - entries[best]); } preference.setSummary(summary); } |