diff options
author | Amith Yamasani <yamasani@google.com> | 2010-01-15 19:10:55 -0800 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2010-01-15 19:10:55 -0800 |
commit | 6ff80dcf7a9e97545be90a4c8e9a85e8a311de96 (patch) | |
tree | c537d8d80b16703e2884ecfb88366d04f84cfbd2 /src/com/android | |
parent | 0e2ab4f884e549d7fb21d0227bf5ee61f9f7958a (diff) | |
download | packages_apps_Settings-6ff80dcf7a9e97545be90a4c8e9a85e8a311de96.zip packages_apps_Settings-6ff80dcf7a9e97545be90a4c8e9a85e8a311de96.tar.gz packages_apps_Settings-6ff80dcf7a9e97545be90a4c8e9a85e8a311de96.tar.bz2 |
Fix #2377870 : NPE in Dock settings
If the Dock settings is launched after reboot but before it is docked,
the settings screen crashes because the dock status is not available.
This fixes the case where there was never a pending intent for dock status.
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/DockSettings.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/settings/DockSettings.java b/src/com/android/settings/DockSettings.java index 5cf8a7e..fe9aeb7 100644 --- a/src/com/android/settings/DockSettings.java +++ b/src/com/android/settings/DockSettings.java @@ -72,6 +72,9 @@ public class DockSettings extends PreferenceActivity { private void initDockSettings() { mAudioSettings = findPreference(KEY_AUDIO_SETTINGS); + if (mAudioSettings != null) { + mAudioSettings.setSummary(R.string.dock_audio_summary_none); + } } private void handleDockChange(Intent intent) { @@ -104,7 +107,9 @@ public class DockSettings extends PreferenceActivity { @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { if (preference == mAudioSettings) { - int dockState = mDockIntent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0); + int dockState = mDockIntent != null + ? mDockIntent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0) + : Intent.EXTRA_DOCK_STATE_UNDOCKED; if (dockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) { showDialog(DIALOG_NOT_DOCKED); } else { |