File tree 1 file changed +6
-3
lines changed
reactive/kotlinx-coroutines-reactive/src
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -184,8 +184,9 @@ private suspend fun <T> Publisher<T>.awaitOne(
184
184
if ((mode == Mode .SINGLE || mode == Mode .SINGLE_OR_DEFAULT ) && seenValue) {
185
185
sub.cancel()
186
186
// the check for `cont.isActive` is just a slight optimization and doesn't affect correctness
187
- if (cont.isActive)
187
+ if (cont.isActive) {
188
188
cont.resumeWithException(IllegalArgumentException (" More than one onNext value for $mode " ))
189
+ }
189
190
} else {
190
191
value = t
191
192
seenValue = true
@@ -200,8 +201,9 @@ private suspend fun <T> Publisher<T>.awaitOne(
200
201
return
201
202
if (seenValue) {
202
203
// the check for `cont.isActive` is just a slight optimization and doesn't affect correctness
203
- if (mode != Mode .FIRST_OR_DEFAULT && mode != Mode .FIRST && cont.isActive)
204
+ if (mode != Mode .FIRST_OR_DEFAULT && mode != Mode .FIRST && cont.isActive) {
204
205
cont.resume(value as T )
206
+ }
205
207
return
206
208
}
207
209
when {
@@ -216,8 +218,9 @@ private suspend fun <T> Publisher<T>.awaitOne(
216
218
}
217
219
218
220
override fun onError (e : Throwable ) {
219
- if (tryEnterTerminalState(" onError" ))
221
+ if (tryEnterTerminalState(" onError" )) {
220
222
cont.resumeWithException(e)
223
+ }
221
224
}
222
225
223
226
/* *
You can’t perform that action at this time.
0 commit comments