From 5f830f8608eaea6a512a97983b124fd13836a59f Mon Sep 17 00:00:00 2001 From: Andy Stadler Date: Thu, 10 Mar 2011 14:56:10 -0800 Subject: [PATCH] Fix race condition NPE caught by monkey Bug: 4080321 Change-Id: Ia6ef0a47f87ffdc96269a95cc3bc5564d2e98440 --- .../email/activity/setup/AccountCheckSettingsFragment.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java b/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java index 44e6061df..96de130c0 100644 --- a/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java +++ b/src/com/android/email/activity/setup/AccountCheckSettingsFragment.java @@ -325,6 +325,7 @@ public class AccountCheckSettingsFragment extends Fragment { * settings) or return to its own parent (e.g. enter new credentials). */ private void onErrorDialogEditButton() { + // 1. handle "edit" - notify callback that we had a problem with the test Callbacks callbackTarget = getCallbackTarget(); if (mState == STATE_AUTODISCOVER_AUTH_DIALOG) { // report auth error to target fragment or activity @@ -333,7 +334,11 @@ public class AccountCheckSettingsFragment extends Fragment { // report check settings failure to target fragment or activity callbackTarget.onCheckSettingsComplete(CHECK_SETTINGS_SERVER_ERROR); } - getFragmentManager().popBackStack(); + // 2. kill self if not already killed by callback + FragmentManager fm = getFragmentManager(); + if (fm != null) { + fm.popBackStack(); + } } /**