From 274deddc88e508c5ddf93c7494401affa8415cfa Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 19 Jan 2019 10:52:35 +0000 Subject: [PATCH] Handle rule exceptions --- .../eu/faircode/email/ServiceSynchronize.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index e24b28ce56..21fce4aa8c 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -2614,12 +2614,17 @@ public class ServiceSynchronize extends LifecycleService { } if (filter) - for (EntityRule rule : rules) - if (rule.matches(context, message, imessage)) { - rule.execute(context, db, message); - if (rule.stop) - break; - } + try { + for (EntityRule rule : rules) + if (rule.matches(context, message, imessage)) { + rule.execute(context, db, message); + if (rule.stop) + break; + } + } catch (Throwable ex) { + Log.e(ex); + db.message().setMessageError(message.id, Helper.formatThrowable(ex)); + } return message; }