From d5f6201cd411175ca80bdc04f05540ef7e66080f Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 22 Mar 2022 14:22:24 +0100 Subject: [PATCH] Added fail safe --- app/src/main/java/eu/faircode/email/Core.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index e64c23c12e..12027c7505 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -2178,17 +2178,21 @@ class Core { if (folder.tbc != null) { try { // Prefix folder with namespace - Folder[] ns = istore.getPersonalNamespaces(); - if (ns != null && ns.length == 1) { - String n = ns[0].getFullName(); - // Typically "" or "INBOX" - if (!TextUtils.isEmpty(n)) { - n += ns[0].getSeparator(); - if (!folder.name.startsWith(n)) { - folder.name = n + folder.name; - db.folder().updateFolder(folder); + try { + Folder[] ns = istore.getPersonalNamespaces(); + if (ns != null && ns.length == 1) { + String n = ns[0].getFullName(); + // Typically "" or "INBOX" + if (!TextUtils.isEmpty(n)) { + n += ns[0].getSeparator(); + if (!folder.name.startsWith(n)) { + folder.name = n + folder.name; + db.folder().updateFolder(folder); + } } } + } catch (MessagingException ex) { + Log.w(ex); } EntityLog.log(context, folder.name + " creating");