Skip to content

Commit

Permalink
Handle missing system property without NPE (#2867)
Browse files Browse the repository at this point in the history
Fixes #2866
  • Loading branch information
sandwwraith authored Dec 5, 2024
1 parent 1b0accd commit 6684f67
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ package kotlinx.serialization.json.internal
* (unlikely) problems with memory consumptions.
*/
private val MAX_CHARS_IN_POOL = runCatching {
System.getProperty("kotlinx.serialization.json.pool.size").toIntOrNull()
}.getOrNull() ?: 2 * 1024 * 1024
System.getProperty("kotlinx.serialization.json.pool.size")?.toIntOrNull()
}.getOrNull() ?: (2 * 1024 * 1024)

internal open class CharArrayPoolBase {
private val arrays = ArrayDeque<CharArray>()
Expand Down

0 comments on commit 6684f67

Please sign in to comment.