Prevent crashing when DataStack is deallocated ahead of ListMonitor and child objects

This commit is contained in:
John Estropia
2019-06-10 18:34:15 +09:00
parent 30ab4386bf
commit 9f397b4337
2 changed files with 19 additions and 4 deletions

View File

@@ -963,8 +963,15 @@ public final class ListMonitor<D: DynamicObject>: Hashable {
return
}
try! newFetchedResultsController.performFetchFromSpecifiedStores()
do {
try newFetchedResultsController.performFetchFromSpecifiedStores()
}
catch {
// DataStack may have been deallocated
return
}
self.fetchedResultsControllerDelegate.taskGroup.notify(queue: .main) {
self.fetchedResultsControllerDelegate.enabled = false