From 052d5a7dc4862f1a898440f2c12a783468d8edcd Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Fri, 3 Jun 2022 09:25:39 -0700 Subject: [PATCH] Fix potential crash when syncing a PDF fails --- .../Sources/Services/DataService/OfflineSync.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apple/OmnivoreKit/Sources/Services/DataService/OfflineSync.swift b/apple/OmnivoreKit/Sources/Services/DataService/OfflineSync.swift index 5f029fb1e..4950b7c9d 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/OfflineSync.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/OfflineSync.swift @@ -60,7 +60,9 @@ public extension DataService { try backgroundContext.save() } } catch { - backgroundContext.rollback() + backgroundContext.performAndWait { + backgroundContext.rollback() + } throw error } }