Fix a NPE trying to download an attachment

b/13642247

Change-Id: I4cfb7e4a3be12fdc8b8c345c1aeabd85a729d16a
This commit is contained in:
Martin Hibdon 2014-03-26 10:38:51 -07:00
parent 74c489f744
commit adabb4285b

View File

@ -155,8 +155,10 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm
// 2. Open the remote folder.
final Account account = Account.restoreAccountWithId(mContext, message.mAccountKey);
Mailbox mailbox = Mailbox.restoreMailboxWithId(mContext, message.mMailboxKey);
if (mailbox.mType == Mailbox.TYPE_OUTBOX) {
if (mailbox == null) {
// This could be null if the account is deleted at just the wrong time.
return;
} else if (mailbox.mType == Mailbox.TYPE_OUTBOX) {
long sourceId = Utility.getFirstRowLong(mContext, Body.CONTENT_URI,
new String[] {BodyColumns.SOURCE_MESSAGE_KEY},
BodyColumns.MESSAGE_KEY + "=?",