Merge "Fix crash in account selector adaptor"

This commit is contained in:
Ben Komalo 2011-08-16 11:53:11 -07:00 committed by Android (Google) Code Review
commit 340ff45ba0

View File

@ -332,7 +332,6 @@ public class AccountSelectorAdapter extends CursorAdapter {
matrixCursor.mAccountCount = accountCursor.getCount(); matrixCursor.mAccountCount = accountCursor.getCount();
int totalUnread = 0; int totalUnread = 0;
int currentPosition = 1;
while (accountCursor.moveToNext()) { while (accountCursor.moveToNext()) {
// Add account, with its unread count. // Add account, with its unread count.
final long accountId = accountCursor.getLong(0); final long accountId = accountCursor.getLong(0);
@ -344,9 +343,8 @@ public class AccountSelectorAdapter extends CursorAdapter {
UNKNOWN_POSITION, accountId); UNKNOWN_POSITION, accountId);
totalUnread += unread; totalUnread += unread;
if (accountId == mAccountId) { if (accountId == mAccountId) {
accountPosition = currentPosition; accountPosition = accountCursor.getPosition();
} }
currentPosition++;
} }
// Add "combined view" if more than one account exists // Add "combined view" if more than one account exists
final int countAccounts = accountCursor.getCount(); final int countAccounts = accountCursor.getCount();