Skip to content

Commit e824eaa

Browse files
committed
Fix SecurityException when trying to read "kotlinx.coroutines.debug" prop
1 parent 340155d commit e824eaa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/CoroutineContext.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import kotlin.coroutines.experimental.CoroutineContext
2323
private const val DEBUG_PROPERTY_NAME = "kotlinx.coroutines.debug"
2424

2525
private val DEBUG = run {
26-
val value = System.getProperty(DEBUG_PROPERTY_NAME)
26+
val value = try { System.getProperty(DEBUG_PROPERTY_NAME) }
27+
catch (e: SecurityException) { null }
2728
when (value) {
2829
"auto", null -> CoroutineId::class.java.desiredAssertionStatus()
2930
"on", "" -> true

0 commit comments

Comments
 (0)