From 81a5ba47c67c75e92772bf8adb04a5361fc79b91 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 26 Aug 2011 17:14:08 -0700 Subject: [PATCH] Be careful before setting account's delete policy * We were using the getSelectedItem() from the deletion spinner to set the account's deletion policy, even if that spinner was invisible (which it would be for IMAP). * The result of this is indeterminate; sigh * The fix is to make sure the spinner is visible before using its value Bug: 5216422 Change-Id: I7e44b5e8127f5277693f7e962899e8642be55239 --- .../activity/setup/AccountSetupIncomingFragment.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/com/android/email/activity/setup/AccountSetupIncomingFragment.java b/src/com/android/email/activity/setup/AccountSetupIncomingFragment.java index e32572ffe..c0d358d9a 100644 --- a/src/com/android/email/activity/setup/AccountSetupIncomingFragment.java +++ b/src/com/android/email/activity/setup/AccountSetupIncomingFragment.java @@ -433,8 +433,12 @@ public class AccountSetupIncomingFragment extends AccountServerBaseFragment { public void onNext() { Account account = SetupData.getAccount(); - account.setDeletePolicy( - (Integer) ((SpinnerOption) mDeletePolicyView.getSelectedItem()).value); + // Make sure delete policy is an valid option before using it; otherwise, the results are + // indeterminate, I suspect... + if (mDeletePolicyView.getVisibility() == View.VISIBLE) { + account.setDeletePolicy( + (Integer) ((SpinnerOption) mDeletePolicyView.getSelectedItem()).value); + } HostAuth recvAuth = account.getOrCreateHostAuthRecv(mContext); String userName = mUsernameView.getText().toString().trim();