From 6e510d0793e0835ad70601868ec55dac24fae4b8 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 11 Aug 2018 18:37:20 +0000 Subject: [PATCH] Quick fix for remote deleted message being composed This will be a rare case --- app/src/main/java/eu/faircode/email/FragmentCompose.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index c0b17bd145..ad904390eb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -60,6 +60,7 @@ import java.util.Date; import java.util.List; import javax.mail.Address; +import javax.mail.MessageRemovedException; import javax.mail.internet.InternetAddress; import androidx.annotation.NonNull; @@ -688,6 +689,11 @@ public class FragmentCompose extends FragmentEx { EntityMessage draft = db.message().getMessage(id); EntityIdentity identity = db.identity().getIdentity(iid); + // Draft deleted by server + // TODO: better handling of remote deleted message + if (draft == null) + throw new MessageRemovedException(); + // Convert data Address afrom[] = (identity == null ? null : new Address[]{new InternetAddress(identity.email, identity.name)}); Address ato[] = (TextUtils.isEmpty(to) ? null : InternetAddress.parse(to));