Merge "Null check mCheckFrequency before using" into ub-mail-algol

This commit is contained in:
Tony Mantler 2014-04-16 17:17:15 +00:00 committed by Android (Google) Code Review
commit 75d60f045b

View File

@ -212,15 +212,21 @@ public class AccountSettingsFragment extends PreferenceFragment
final CharSequence [] syncIntervals =
savedInstanceState.getCharSequenceArray(SAVESTATE_SYNC_INTERVALS);
mCheckFrequency = (ListPreference) findPreference(PREFERENCE_FREQUENCY);
if (mCheckFrequency != null) {
mCheckFrequency.setEntries(syncIntervalStrings);
mCheckFrequency.setEntryValues(syncIntervals);
}
}
}
public void onSaveInstanceState(Bundle outstate) {
super.onSaveInstanceState(outstate);
outstate.putCharSequenceArray(SAVESTATE_SYNC_INTERVAL_STRINGS, mCheckFrequency.getEntries());
outstate.putCharSequenceArray(SAVESTATE_SYNC_INTERVALS, mCheckFrequency.getEntryValues());
if (mCheckFrequency != null) {
outstate.putCharSequenceArray(SAVESTATE_SYNC_INTERVAL_STRINGS,
mCheckFrequency.getEntries());
outstate.putCharSequenceArray(SAVESTATE_SYNC_INTERVALS,
mCheckFrequency.getEntryValues());
}
}
@Override