Skip to content
Permalink
Browse files

Always call finish()

Ensure that we always call finish() even if the coroutineScope is cancelled or some other exception is raised.
  • Loading branch information...
ianhanniballake committed Oct 20, 2019
1 parent a33c5fa commit d9899b5d35336d7fdfd6007b13506b249afa754e
@@ -27,7 +27,11 @@ fun BroadcastReceiver.goAsync(
) {
val result = goAsync()
coroutineScope.launch {
block()
result.finish()
try {
block()
} finally {
// Always call finish(), even if the coroutineScope was cancelled
result.finish()
}
}
}

0 comments on commit d9899b5

Please sign in to comment.
You can’t perform that action at this time.