Skip to content

Commit 287c134

Browse files
authored
Merge pull request #97 from ArnaudWurmel/bugfix/crash-atomics-value
[Bugfix] Crashes when reading the body in Release configurations
2 parents e87be01 + 6f84ef7 commit 287c134

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/Atomic.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ final class Atomic<Value> {
6969
@discardableResult
7070
func modify(action: (Value) throws -> Value) rethrows -> Value {
7171
return try withValue { value in
72+
let oldValue = value
7273
_value = try action(value)
73-
return value
74+
return oldValue
7475
}
7576
}
7677

0 commit comments

Comments
 (0)