Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97ed7f6d authored by cketti's avatar cketti
Browse files

Fix crash when loading attachment metadata fails

parent 7d429d56
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -299,9 +299,14 @@ public class AttachmentPresenter {
                        return;
                    }

                    if (attachment.state == LoadingState.METADATA) {
                        attachmentMvpView.updateAttachmentView(attachment);
                        attachments.put(attachment.uri, attachment);
                        initAttachmentContentLoader(attachment);
                    } else {
                        attachments.remove(attachment.uri);
                        attachmentMvpView.removeAttachmentView(attachment);
                    }
                }

                @Override
+0 −3
Original line number Diff line number Diff line
@@ -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);
    }