summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Stadler <stadler@google.com>2011-03-25 16:11:09 -0700
committerAndy Stadler <stadler@google.com>2011-03-25 16:11:09 -0700
commit397439881a60c5469492e987cbd343cc1fcf527f (patch)
tree2d9b0608c595e734490949ea147c4e275fa05a6b
parent8f0a79c2ef29b714110ee00a4fc28f97a729d4ef (diff)
downloadandroid_packages_apps_Email-397439881a60c5469492e987cbd343cc1fcf527f.tar.gz
android_packages_apps_Email-397439881a60c5469492e987cbd343cc1fcf527f.tar.bz2
android_packages_apps_Email-397439881a60c5469492e987cbd343cc1fcf527f.zip
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
-rw-r--r--src/com/android/email/Controller.java3
1 files changed, 3 insertions, 0 deletions
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