diff --git a/email2/src/com/android/email/provider/EmailProvider.java b/email2/src/com/android/email/provider/EmailProvider.java index 9dd13b840..14710b321 100644 --- a/email2/src/com/android/email/provider/EmailProvider.java +++ b/email2/src/com/android/email/provider/EmailProvider.java @@ -3022,14 +3022,14 @@ outer: } // Get attachments from the ContentValues - ArrayList uiAtts = - com.android.mail.providers.Attachment.getAttachmentsFromJoinedAttachmentInfo( + List uiAtts = + com.android.mail.providers.Attachment.fromJSONArray( values.getAsString(UIProvider.MessageColumns.JOINED_ATTACHMENT_INFOS)); ArrayList atts = new ArrayList(); boolean hasUnloadedAttachments = false; for (com.android.mail.providers.Attachment uiAtt: uiAtts) { - Uri attUri = uiAtt.contentUri; - if (attUri.getAuthority().equals(EmailContent.AUTHORITY)) { + Uri attUri = uiAtt.uri; + if (attUri != null && attUri.getAuthority().equals(EmailContent.AUTHORITY)) { // If it's one of ours, retrieve the attachment and add it to the list long attId = Long.parseLong(attUri.getLastPathSegment()); Attachment att = Attachment.restoreAttachmentWithId(context, attId); diff --git a/email2/src/com/android/email/service/EmailServiceStub.java b/email2/src/com/android/email/service/EmailServiceStub.java index f7b8c1369..5d32da775 100644 --- a/email2/src/com/android/email/service/EmailServiceStub.java +++ b/email2/src/com/android/email/service/EmailServiceStub.java @@ -228,11 +228,13 @@ public abstract class EmailServiceStub extends IEmailService.Stub implements IEm new String[] {BodyColumns.SOURCE_MESSAGE_KEY}, BodyColumns.MESSAGE_KEY + "=?", new String[] {Long.toString(messageId)}, null, 0, -1L); - if (sourceId != -1L) { + if (sourceId != -1 ) { EmailContent.Message sourceMsg = EmailContent.Message.restoreMessageWithId(mContext, sourceId); - mailbox = Mailbox.restoreMailboxWithId(mContext, sourceMsg.mMailboxKey); - message.mServerId = sourceMsg.mServerId; + if (sourceMsg != null) { + mailbox = Mailbox.restoreMailboxWithId(mContext, sourceMsg.mMailboxKey); + message.mServerId = sourceMsg.mServerId; + } } }