Fixed SendElement.tryResumeSend
Was failing with java.lang.AssertionError
at kotlinx.coroutines.channels.SendElement.tryResumeSend(AbstractChannel.kt:1055)
at kotlinx.coroutines.channels.AbstractChannel.pollInternal(AbstractChannel.kt:510)
at kotlinx.coroutines.channels.AbstractChannel.receive(AbstractChannel.kt:548)
diff --git a/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt b/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt
index ce0acc0..489d24c 100644
--- a/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt
+++ b/kotlinx-coroutines-core/common/src/channels/AbstractChannel.kt
@@ -1051,7 +1051,7 @@
) : Send() {
override fun tryResumeSend(otherOp: PrepareOp?): Symbol? {
otherOp?.finishPrepare()
- val token = cont.tryResume(Unit, otherOp?.desc)
+ val token = cont.tryResume(Unit, otherOp?.desc) ?: return null
assert { token === RESUME_TOKEN } // the only other possible result
return RESUME_TOKEN
}