From 07c76bca4f20cb6bfa11af357fc39da7502524bc Mon Sep 17 00:00:00 2001 From: Philippe Weidmann Date: Thu, 29 Jun 2023 07:34:01 +0200 Subject: [PATCH] fix(AccountManager): Realm crash access wrong thread --- MailCore/Cache/AccountManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MailCore/Cache/AccountManager.swift b/MailCore/Cache/AccountManager.swift index 2a62a3116..83a2215c1 100644 --- a/MailCore/Cache/AccountManager.swift +++ b/MailCore/Cache/AccountManager.swift @@ -284,7 +284,7 @@ public class AccountManager: RefreshTokenDelegate { } MailboxInfosManager.instance.storeMailboxes(user: user, mailboxes: mailboxesResponse) - if let mainMailbox = mailboxesResponse.first(where: { $0.isPrimary }) ?? mailboxesResponse.first { + if let mainMailbox = (mailboxesResponse.first(where: { $0.isPrimary }) ?? mailboxesResponse.first)?.freezeIfNeeded() { await notificationService.updateTopicsIfNeeded([mainMailbox.notificationTopicName], userApiFetcher: apiFetcher) setCurrentMailboxForCurrentAccount(mailbox: mainMailbox) }