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 4383662
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 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,8 @@ object Cancelable {

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

Expand Down

0 comments on commit 4383662

Please sign in to comment.