Merge "Fix b/265054711: Settings crash on changing device orientation from battery usage page."
diff --git a/src/com/android/settings/fuelgauge/batteryusage/SpinnerPreference.java b/src/com/android/settings/fuelgauge/batteryusage/SpinnerPreference.java
index 47e051c..eaac00a 100644
--- a/src/com/android/settings/fuelgauge/batteryusage/SpinnerPreference.java
+++ b/src/com/android/settings/fuelgauge/batteryusage/SpinnerPreference.java
@@ -66,6 +66,9 @@
@Override
protected Parcelable onSaveInstanceState() {
+ if (mSpinner == null) {
+ return super.onSaveInstanceState();
+ }
Log.d(TAG, "onSaveInstanceState() spinnerPosition=" + mSpinner.getSelectedItemPosition());
return new SavedState(super.onSaveInstanceState(), mSpinner.getSelectedItemPosition());
}