Do not try to load nameless attachments.
Bug: 11347094 Change-Id: I46321755cebe25858c0188f35270d428dfe4a435
This commit is contained in:
parent
19b89b4bea
commit
feacaf6351
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue