Skip to content

Commit

Permalink
fix Cancelable.Builder if it is cancelled while subscribing
Browse files Browse the repository at this point in the history
  • Loading branch information
cornerman committed Nov 8, 2023
1 parent 29351ce commit 9f2e076
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion colibri/src/main/scala/colibri/Cancelable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ object Cancelable {

def unsafeAdd(subscription: () => Cancelable): Unit = if (buffer != null) {
val cancelable = subscription()
buffer.push(cancelable)
if (buffer == null) {
cancelable.cancel()
} else {
buffer.push(cancelable)
}
()
}

Expand Down

0 comments on commit 9f2e076

Please sign in to comment.