diff --git a/mirai-core/src/commonMain/kotlin/network/auth/CoroutineOnDemandValueScope.kt b/mirai-core/src/commonMain/kotlin/network/auth/CoroutineOnDemandValueScope.kt index 71ba2169e..0365060a7 100644 --- a/mirai-core/src/commonMain/kotlin/network/auth/CoroutineOnDemandValueScope.kt +++ b/mirai-core/src/commonMain/kotlin/network/auth/CoroutineOnDemandValueScope.kt @@ -99,7 +99,7 @@ internal class CoroutineOnDemandValueScope( private fun finishImpl(exception: Throwable?) { state.loop { state -> when (state) { - is ProducerState.Finished -> throw state.createAlreadyFinishedException(exception) + is ProducerState.Finished -> {} // ignore else -> { if (compareAndSetState(state, ProducerState.Finished(state, exception))) { val cancellationException = kotlinx.coroutines.CancellationException("Finished", exception) @@ -153,6 +153,7 @@ internal class CoroutineOnDemandValueScope( } return null } + else -> throw IllegalProducerStateException(state) } }