Merge "Fix crash in finish from onCreate." into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-06-10 15:06:34 +00:00
committed by Android (Google) Code Review

View File

@@ -690,7 +690,10 @@ public abstract class SettingsPreferenceFragment extends InstrumentedPreferenceF
public void finish() {
Activity activity = getActivity();
if (activity != null && !activity.getFragmentManager().popBackStackImmediate()) {
if (activity == null) return;
if (getFragmentManager().getBackStackEntryCount() > 0) {
getFragmentManager().popBackStack();
} else {
activity.finish();
}
}