Skip to content

Commit 9ebd33e

Browse files
committed
Handle missing system property without NPE
Fixes #2866
1 parent 1758faa commit 9ebd33e

File tree

1 file changed

+2
-2
lines changed
  • formats/json/jvmMain/src/kotlinx/serialization/json/internal

1 file changed

+2
-2
lines changed

formats/json/jvmMain/src/kotlinx/serialization/json/internal/ArrayPools.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ package kotlinx.serialization.json.internal
88
* (unlikely) problems with memory consumptions.
99
*/
1010
private val MAX_CHARS_IN_POOL = runCatching {
11-
System.getProperty("kotlinx.serialization.json.pool.size").toIntOrNull()
12-
}.getOrNull() ?: 2 * 1024 * 1024
11+
System.getProperty("kotlinx.serialization.json.pool.size")?.toIntOrNull()
12+
}.getOrNull() ?: (2 * 1024 * 1024)
1313

1414
internal open class CharArrayPoolBase {
1515
private val arrays = ArrayDeque<CharArray>()

0 commit comments

Comments
 (0)