Skip to content

Commit

Permalink
Fix crash with atomic values
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud Wurmel committed Apr 23, 2021
1 parent 065b6ce commit 1e11704
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/Atomic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ final class Atomic<Value> {
@discardableResult
func modify(action: (Value) throws -> Value) rethrows -> Value {
return try withValue { value in
let oldValue = value
_value = try action(value)
return value
return oldValue
}
}

Expand Down

0 comments on commit 1e11704

Please sign in to comment.