From b0be5058f561f30bb23758baaa0450ba60fbc723 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 28 Dec 2018 16:20:45 +0000 Subject: [PATCH] Improved operation error handling --- .../main/java/eu/faircode/email/ServiceSynchronize.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index f18967cb10..ceea98b161 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -1501,14 +1501,16 @@ public class ServiceSynchronize extends LifecycleService { if (ex instanceof MessageRemovedException || ex instanceof FolderNotFoundException || - ex instanceof SendFailedException) { + ex instanceof SendFailedException || + ex instanceof IllegalArgumentException) { Log.w("Unrecoverable", ex); // There is no use in repeating db.operation().deleteOperation(op.id); - if (ex instanceof MessageRemovedException) - db.message().deleteMessage(op.message); + if (message != null && + ex instanceof MessageRemovedException) + db.message().deleteMessage(message.id); continue; } else if (ex instanceof MessagingException) {