Skip to content

Commit 6684f67

Browse files
authored
Handle missing system property without NPE (#2867)
Fixes #2866
1 parent 1b0accd commit 6684f67

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

+2-2
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)