From 397439881a60c5469492e987cbd343cc1fcf527f Mon Sep 17 00:00:00 2001 From: Andy Stadler Date: Fri, 25 Mar 2011 16:11:09 -0700 Subject: [PATCH] DO NOT MERGE - 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 Backport of: I831e3abd100664c92f7af585014a03250e40ff64 Change-Id: Iffdf8cdc3a17c0ab691596eb9e240ef87acb2e37 --- src/com/android/email/Controller.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/email/Controller.java b/src/com/android/email/Controller.java index 633a5f4b9..b3e2c2a39 100644 --- a/src/com/android/email/Controller.java +++ b/src/com/android/email/Controller.java @@ -746,6 +746,9 @@ public class Controller { File saveToFile = AttachmentProvider.getAttachmentFilename(mProviderContext, accountId, attachmentId); Attachment attachInfo = Attachment.restoreAttachmentWithId(mProviderContext, attachmentId); + if (attachInfo == null) { + return; + } if (saveToFile.exists() && attachInfo.mContentUri != null) { // The attachment has already been downloaded, so we will just "pretend" to download it