From 5a2c9878cc2d624f1578c30e13c00568f95b1c46 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 24 Aug 2021 13:29:20 +0200 Subject: [PATCH] Fixed edge case system folder renaming --- app/src/main/java/eu/faircode/email/Core.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 62dde16d72..ee9cbe0b74 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -2051,13 +2051,16 @@ class Core { if (type != null && !EntityFolder.USER.equals(type) && !EntityFolder.SYSTEM.equals(type)) { - for (EntityFolder folder : local.values()) + for (EntityFolder folder : new ArrayList<>(local.values())) if (type.equals(folder.type) && !fullName.equals(folder.name) && + !local.containsKey(fullName) && !istore.getFolder(folder.name).exists()) { Log.e(account.host + " renaming " + type + " folder" + " from " + folder.name + " to " + fullName); + local.remove(folder.name); + local.put(fullName, folder); folder.name = fullName; db.folder().setFolderName(folder.id, fullName); }