Fix for Xcode 12.5.1

Without this change, the compiler would crash with Abort trap: 6
This commit is contained in:
Gwendal Roué committed 2022-03-22 09:26:12 +01:00
1 parent 727ca68b98
commit 8a6e784428
1 file changed
+3 -3
@@ -150,10 +150,10 @@ final class ValueWriteOnlyObserver<Writer: DatabaseWriter, Reducer: ValueReducer
extension ValueWriteOnlyObserver {
// Starts the observation
func start() -> DatabaseCancellable {
let (notificationCallbacks, writer) = lock.synchronized {
(self.notificationCallbacks, databaseAccess?.writer)
let (notificationCallbacks, databaseAccess) = lock.synchronized {
(self.notificationCallbacks, self.databaseAccess)
}
guard let notificationCallbacks = notificationCallbacks, let writer = writer else {
guard let notificationCallbacks = notificationCallbacks, let writer = databaseAccess?.writer else {
// Likely a GRDB bug
fatalError("can't start a cancelled or failed observation")
}