Skip to content

Commit 76fcbc7

Browse files
authored
fix: crash on fetchResultsController perform - WPB-22117 (#4003)
1 parent 0ccd7f1 commit 76fcbc7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

WireDomain/Sources/WireDomain/Synchronization/ConversationUpdatesGenerator.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ public final class ConversationUpdatesGenerator: NSObject, ConversationUpdatesGe
4949
fetchedResultsController = createFetchRequestController()
5050
fetchedResultsController?.delegate = self
5151
}
52+
await context.perform {
53+
do {
54+
try self.fetchedResultsController?.performFetch()
55+
} catch {
56+
WireLogger.conversation.error("error fetching conversations: \(String(describing: error))")
57+
}
5258

53-
do {
54-
try fetchedResultsController?.performFetch()
55-
} catch {
56-
WireLogger.conversation.error("error fetching conversations: \(String(describing: error))")
57-
}
59+
let conversations = self.fetchedResultsController?.fetchedObjects ?? []
60+
for conversation in conversations {
5861

59-
let conversations = fetchedResultsController?.fetchedObjects ?? []
60-
for conversation in conversations {
61-
await context.perform {
6262
if let id = conversation.qualifiedID {
6363
self.onConversationUpdated(UpdateConversationItem(
6464
repository: self.repository,

0 commit comments

Comments
 (0)