Fix NPE when trying to open attachments

The attachment info may be null when we attempt to mark them for downloading.
Add a null-check before we try to dereference the info structure.

bug 4053184

Change-Id: I831e3abd100664c92f7af585014a03250e40ff64
This commit is contained in:
Todd Kennedy 2011-03-09 16:44:44 -08:00
parent 70e99aa97f
commit edd1c9ac7e
1 changed files with 4 additions and 1 deletions

View File

@ -868,8 +868,11 @@ public class Controller {
*/
public void loadAttachment(final long attachmentId, final long messageId,
final long accountId) {
Attachment attachInfo = Attachment.restoreAttachmentWithId(mProviderContext, attachmentId);
if (attachInfo == null) {
return;
}
if (Utility.attachmentExists(mProviderContext, attachInfo)) {
// The attachment has already been downloaded, so we will just "pretend" to download it
// This presumably is for POP3 messages