From 8c55c6dc8d8dde6492bf962a048dce151f05fdb0 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 13 Mar 2019 16:55:29 +0000 Subject: [PATCH] Catch attachments parse exceptions --- app/src/main/java/eu/faircode/email/MessageHelper.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index 0285d05117..f33da55a76 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -644,7 +644,13 @@ public class MessageHelper { List result = new ArrayList<>(); for (AttachmentPart apart : attachments) { - ContentType ct = new ContentType(apart.part.getContentType()); + ContentType ct; + try { + ct = new ContentType(apart.part.getContentType()); + } catch (ParseException ex) { + Log.w(ex); + ct = new ContentType("application/octet-stream"); + } String[] cid = apart.part.getHeader("Content-ID"); EntityAttachment attachment = new EntityAttachment();