Check null pointer in MessageList

BUG: 2299971
This commit is contained in:
satok 2009-12-07 17:09:57 +09:00
parent 3c1334ae1f
commit 9151d86e68

View File

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