Skip to content

Commit 1736c87

Browse files
committed
Fix NPE caused by casting chainId to Double.
1 parent 4a32c74 commit 1736c87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/src/main/kotlin/org/walletconnect/types/TypeMapConversion.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fun Session.SessionParams.intoMap(params: MutableMap<String, Any?> = mutableMapO
4646

4747
fun Map<String, *>.extractSessionParams(): Session.SessionParams {
4848
val approved = this["approved"] as? Boolean ?: throw IllegalArgumentException("approved missing")
49-
val chainId = (this["chainId"] as Double).toLong()
49+
val chainId = (this["chainId"] as? Double)?.toLong()
5050
val accounts = nullOnThrow { (this["accounts"] as? List<*>)?.toStringList() }
5151

5252
return Session.SessionParams(approved, chainId, accounts, nullOnThrow { this.extractPeerData() })

0 commit comments

Comments
 (0)