From 1144e6c93f112be5008d0bb79d774c0de2134a87 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Tue, 4 Jan 2011 11:50:40 -0800 Subject: [PATCH] Fix NPE in loadAttachmentCallback bug 3317175 Change-Id: Ib892af0b1bf00cd99c370e114dd8d98b6887933c --- src/com/android/email/activity/MessageViewFragmentBase.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/email/activity/MessageViewFragmentBase.java b/src/com/android/email/activity/MessageViewFragmentBase.java index 64d675299..903e94059 100644 --- a/src/com/android/email/activity/MessageViewFragmentBase.java +++ b/src/com/android/email/activity/MessageViewFragmentBase.java @@ -1415,6 +1415,11 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O } } else { AttachmentInfo attachment = findAttachmentInfo(attachmentId); + if (attachment == null) { + // Called before LoadAttachmentsTask finishes. + // (Possible if you quickly close & re-open a message) + return; + } attachment.cancelButton.setVisibility(View.GONE); attachment.loadButton.setVisibility(View.VISIBLE); attachment.progressView.setVisibility(View.INVISIBLE);