summaryrefslogtreecommitdiffstats
path: root/emailcommon
diff options
context:
space:
mode:
authorYu Ping Hu <yph@google.com>2013-10-24 20:11:21 -0700
committerYu Ping Hu <yph@google.com>2013-10-25 14:21:02 -0700
commitfeacaf6351ad981890fd6dc790added452e3a570 (patch)
tree8ef5c21f7de5439397bee593eb2eae45daed662c /emailcommon
parent19b89b4beaa7b3fb4a23d426e8e6c0210498a270 (diff)
downloadandroid_packages_apps_Email-feacaf6351ad981890fd6dc790added452e3a570.tar.gz
android_packages_apps_Email-feacaf6351ad981890fd6dc790added452e3a570.tar.bz2
android_packages_apps_Email-feacaf6351ad981890fd6dc790added452e3a570.zip
Do not try to load nameless attachments.
Bug: 11347094 Change-Id: I46321755cebe25858c0188f35270d428dfe4a435
Diffstat (limited to 'emailcommon')
-rw-r--r--emailcommon/src/com/android/emailcommon/utility/AttachmentUtilities.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/emailcommon/src/com/android/emailcommon/utility/AttachmentUtilities.java b/emailcommon/src/com/android/emailcommon/utility/AttachmentUtilities.java
index 2f807d737..e889f9774 100644
--- a/emailcommon/src/com/android/emailcommon/utility/AttachmentUtilities.java
+++ b/emailcommon/src/com/android/emailcommon/utility/AttachmentUtilities.java
@@ -395,6 +395,13 @@ public class AttachmentUtilities {
size = copyFile(in, resolver.openOutputStream(attUri));
contentUri = attUri.toString();
} else if (Utility.isExternalStorageMounted()) {
+ if (attachment.mFileName == null) {
+ // TODO: This will prevent a crash but does not surface the underlying problem
+ // to the user correctly.
+ LogUtils.w(Logging.LOG_TAG, "Trying to save an attachment with no name: %d",
+ attachmentId);
+ throw new IOException("Can't save an attachment with no name");
+ }
File downloads = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOWNLOADS);
downloads.mkdirs();