Skip to content

Commit 0caceb5

Browse files
authored
Merge pull request #2 from ProjectOpenSea/prashan/casting-fix
Fix NPE caused by casting chainId to Double.
2 parents 4a32c74 + 1736c87 commit 0caceb5

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)