From 7a3b64d56e3c3c37d02b50051b8a57f067856c2e Mon Sep 17 00:00:00 2001 From: Ben Komalo Date: Tue, 16 Aug 2011 10:40:33 -0700 Subject: [PATCH] Fix crash in account selector adaptor Removal of the accounts header broke code that assumed the list of accounts started at index 1. Change code so that it doesn't rely on that assumption. Bug: 5171557 Change-Id: Idde445cac914c4a742c54e291d808b991e612c5f --- src/com/android/email/activity/AccountSelectorAdapter.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/com/android/email/activity/AccountSelectorAdapter.java b/src/com/android/email/activity/AccountSelectorAdapter.java index a06fe8b4a..a1c33356b 100644 --- a/src/com/android/email/activity/AccountSelectorAdapter.java +++ b/src/com/android/email/activity/AccountSelectorAdapter.java @@ -332,7 +332,6 @@ public class AccountSelectorAdapter extends CursorAdapter { matrixCursor.mAccountCount = accountCursor.getCount(); int totalUnread = 0; - int currentPosition = 1; while (accountCursor.moveToNext()) { // Add account, with its unread count. final long accountId = accountCursor.getLong(0); @@ -344,9 +343,8 @@ public class AccountSelectorAdapter extends CursorAdapter { UNKNOWN_POSITION, accountId); totalUnread += unread; if (accountId == mAccountId) { - accountPosition = currentPosition; + accountPosition = accountCursor.getPosition(); } - currentPosition++; } // Add "combined view" if more than one account exists final int countAccounts = accountCursor.getCount();