Fix possible NPE when Screen settings is launched quickly in succession.

Bug: 3368440
Change-Id: Icbcd0474978e20a055ec27f5960e9a4b98f4a68a
This commit is contained in:
Amith Yamasani
2011-03-10 16:49:45 -08:00
parent 025247c768
commit be606d6d0e

View File

@@ -76,6 +76,12 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
addPreferencesFromResource(R.xml.display_settings);
// Fetch this once before attaching a listener for changes.
try {
mAnimationScales = mWindowManager.getAnimationScales();
} catch (RemoteException e) {
// Shouldn't happen and not much can be done anyway.
}
mAnimations = (ListPreference) findPreference(KEY_ANIMATIONS);
mAnimations.setOnPreferenceChangeListener(this);
mAccelerometer = (CheckBoxPreference) findPreference(KEY_ACCELEROMETER);
@@ -189,6 +195,7 @@ public class DisplaySettings extends SettingsPreferenceFragment implements
try {
mAnimationScales = mWindowManager.getAnimationScales();
} catch (RemoteException e) {
// Shouldn't happen and not much can be done anyway.
}
if (mAnimationScales != null) {
if (mAnimationScales.length >= 1) {