Merge "Fix crash when clearing preference screen" into nyc-dev

This commit is contained in:
Jason Monk
2016-03-29 17:23:32 +00:00
committed by Android (Google) Code Review

View File

@@ -305,7 +305,7 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
@Override
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
if (!preferenceScreen.isAttached()) {
if (preferenceScreen != null && !preferenceScreen.isAttached()) {
// Without ids generated, the RecyclerView won't animate changes to the preferences.
preferenceScreen.setShouldUseGeneratedIds(mAnimationAllowed);
}