Skip to content

Commit 2005784

Browse files
committed
Fixed bug where the documentation said negative demand would wrap to zero, but it spews EXC_BREAKPOINTs instead.
1 parent e49d05b commit 2005784

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/Vexil/Pole+Observability.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ extension FlagPublisher {
104104

105105
// Calculate current demand
106106
let stillHasDemand = state.withLock { state in
107-
state.demand -= 1
107+
if state.demand > 0 {
108+
state.demand -= 1
109+
}
108110
state.demand += additionalDemand
109111
return state.demand > 0
110112
}

0 commit comments

Comments
 (0)