Skip to content

Commit 4baba2b

Browse files
committed
Add some curly braces
1 parent 0c6f6da commit 4baba2b

File tree

1 file changed

+6
-3
lines changed
  • reactive/kotlinx-coroutines-reactive/src

1 file changed

+6
-3
lines changed

reactive/kotlinx-coroutines-reactive/src/Await.kt

+6-3
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ private suspend fun <T> Publisher<T>.awaitOne(
184184
if ((mode == Mode.SINGLE || mode == Mode.SINGLE_OR_DEFAULT) && seenValue) {
185185
sub.cancel()
186186
// the check for `cont.isActive` is just a slight optimization and doesn't affect correctness
187-
if (cont.isActive)
187+
if (cont.isActive) {
188188
cont.resumeWithException(IllegalArgumentException("More than one onNext value for $mode"))
189+
}
189190
} else {
190191
value = t
191192
seenValue = true
@@ -200,8 +201,9 @@ private suspend fun <T> Publisher<T>.awaitOne(
200201
return
201202
if (seenValue) {
202203
// 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) {
204205
cont.resume(value as T)
206+
}
205207
return
206208
}
207209
when {
@@ -216,8 +218,9 @@ private suspend fun <T> Publisher<T>.awaitOne(
216218
}
217219

218220
override fun onError(e: Throwable) {
219-
if (tryEnterTerminalState("onError"))
221+
if (tryEnterTerminalState("onError")) {
220222
cont.resumeWithException(e)
223+
}
221224
}
222225

223226
/**

0 commit comments

Comments
 (0)