From 30590c29fa20c1f53a8eae67223bf0d08daefa2e Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 26 Oct 2021 07:56:37 +0200 Subject: [PATCH] Prevent crash --- .../main/java/eu/faircode/email/ContactInfo.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ContactInfo.java b/app/src/main/java/eu/faircode/email/ContactInfo.java index fe47892723..4d1286968b 100644 --- a/app/src/main/java/eu/faircode/email/ContactInfo.java +++ b/app/src/main/java/eu/faircode/email/ContactInfo.java @@ -521,11 +521,14 @@ public class ContactInfo { if (info.displayName == null) info.displayName = address.getPersonal(); - if (!info.known && !TextUtils.isEmpty(info.email)) { - DB db = DB.getInstance(context); - EntityContact contact = db.contact().getContact(account, EntityContact.TYPE_TO, info.email); - info.known = (contact != null); - } + if (!info.known && !TextUtils.isEmpty(info.email)) + try { + DB db = DB.getInstance(context); + EntityContact contact = db.contact().getContact(account, EntityContact.TYPE_TO, info.email); + info.known = (contact != null); + } catch (Throwable ex) { + Log.e(ex); + } synchronized (emailContactInfo) { emailContactInfo.put(key, info);