Fix crash when loading attachment metadata fails
This commit is contained in:
parent
7d429d565b
commit
97ed7f6dc3
2 changed files with 8 additions and 6 deletions
|
@ -299,9 +299,14 @@ public class AttachmentPresenter {
|
|||
return;
|
||||
}
|
||||
|
||||
attachmentMvpView.updateAttachmentView(attachment);
|
||||
attachments.put(attachment.uri, attachment);
|
||||
initAttachmentContentLoader(attachment);
|
||||
if (attachment.state == LoadingState.METADATA) {
|
||||
attachmentMvpView.updateAttachmentView(attachment);
|
||||
attachments.put(attachment.uri, attachment);
|
||||
initAttachmentContentLoader(attachment);
|
||||
} else {
|
||||
attachments.remove(attachment.uri);
|
||||
attachmentMvpView.removeAttachmentView(attachment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -156,9 +156,6 @@ public class Attachment implements Parcelable, com.fsck.k9.message.Attachment {
|
|||
}
|
||||
|
||||
public Attachment deriveWithLoadCancelled() {
|
||||
if (state != Attachment.LoadingState.METADATA) {
|
||||
throw new IllegalStateException("deriveWitLoadCancelled can only be called on a METADATA attachment!");
|
||||
}
|
||||
return new Attachment(uri, Attachment.LoadingState.CANCELLED, loaderId, contentType, allowMessageType, name,
|
||||
size, null, internalAttachment);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue