am ec3daeed: Merge change I783790b6 into eclair-mr2

Merge commit 'ec3daeedb3ba65230a49d91b2ca6a3032fb3bd76' into eclair-mr2-plus-aosp

* commit 'ec3daeedb3ba65230a49d91b2ca6a3032fb3bd76':
  Check null pointer in MessageList
This commit is contained in:
satok 2009-12-16 00:05:34 -08:00 committed by Android Git Automerger
commit 4da26f2859

View File

@ -575,15 +575,28 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
}
EmailContent.Mailbox mailbox =
EmailContent.Mailbox.restoreMailboxWithId(this, mailboxId);
if (mailbox == null) {
return -2;
}
return mailbox.mAccountKey;
}
private void onCompose() {
MessageCompose.actionCompose(this, lookupAccountIdFromMailboxId(mMailboxId));
long accountKey = lookupAccountIdFromMailboxId(mMailboxId);
if (accountKey > -2) {
MessageCompose.actionCompose(this, accountKey);
} else {
finish();
}
}
private void onEditAccount() {
AccountSettings.actionSettings(this, lookupAccountIdFromMailboxId(mMailboxId));
long accountKey = lookupAccountIdFromMailboxId(mMailboxId);
if (accountKey > -2) {
AccountSettings.actionSettings(this, accountKey);
} else {
finish();
}
}
private void onDeselectAll() {
@ -638,8 +651,12 @@ public class MessageList extends ListActivity implements OnItemClickListener, On
c.close();
}
} else {
long accountId = lookupAccountIdFromMailboxId(mMailboxId);
mController.sendPendingMessages(accountId, mControllerCallback);
long accountKey = lookupAccountIdFromMailboxId(mMailboxId);
if (accountKey > -2) {
mController.sendPendingMessages(accountKey, mControllerCallback);
} else {
finish();
}
}
}