Merge "DO NOT MERGE - Fix NPE when trying to open attachments" into gingerbread

This commit is contained in:
Andy Stadler 2011-03-25 16:43:50 -07:00 committed by Android (Google) Code Review
commit aba60dfb73

View File

@ -746,6 +746,9 @@ public class Controller {
File saveToFile = AttachmentProvider.getAttachmentFilename(mProviderContext, File saveToFile = AttachmentProvider.getAttachmentFilename(mProviderContext,
accountId, attachmentId); accountId, attachmentId);
Attachment attachInfo = Attachment.restoreAttachmentWithId(mProviderContext, attachmentId); Attachment attachInfo = Attachment.restoreAttachmentWithId(mProviderContext, attachmentId);
if (attachInfo == null) {
return;
}
if (saveToFile.exists() && attachInfo.mContentUri != null) { if (saveToFile.exists() && attachInfo.mContentUri != null) {
// The attachment has already been downloaded, so we will just "pretend" to download it // The attachment has already been downloaded, so we will just "pretend" to download it