File tree 1 file changed +7
-4
lines changed
kotlinx-coroutines-core/common/src/internal
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -41,19 +41,22 @@ internal abstract class DispatchedTask<in T>(
41
41
val state = takeState() // NOTE: Must take state in any case, even if cancelled
42
42
withCoroutineContext(context, delegate.countOrElement) {
43
43
val exception = getExceptionalResult(state)
44
- val job = if (resumeMode.isCancellableMode) context[Job ] else null
45
44
/*
46
45
* Check whether continuation was originally resumed with an exception.
47
46
* If so, it dominates cancellation, otherwise the original exception
48
47
* will be silently lost.
49
48
*/
50
- if (exception == null && job != null && ! job.isActive) {
49
+ val job = if (exception == null && resumeMode.isCancellableMode) context[Job ] else null
50
+ if (job != null && ! job.isActive) {
51
51
val cause = job.getCancellationException()
52
52
cancelResult(state, cause)
53
53
continuation.resumeWithStackTrace(cause)
54
54
} else {
55
- if (exception != null ) continuation.resumeWithException(exception)
56
- else continuation.resume(getSuccessfulResult(state))
55
+ if (exception != null ) {
56
+ continuation.resumeWithException(exception)
57
+ } else {
58
+ continuation.resume(getSuccessfulResult(state))
59
+ }
57
60
}
58
61
}
59
62
} catch (e: Throwable ) {
You can’t perform that action at this time.
0 commit comments