From 1736c87d5f4632db8217284c238862de31365b24 Mon Sep 17 00:00:00 2001 From: Prashan Dharmasena Date: Wed, 10 Aug 2022 17:59:34 -0400 Subject: [PATCH] Fix NPE caused by casting chainId to Double. --- .../main/kotlin/org/walletconnect/types/TypeMapConversion.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/main/kotlin/org/walletconnect/types/TypeMapConversion.kt b/lib/src/main/kotlin/org/walletconnect/types/TypeMapConversion.kt index d03308d..da1e3ca 100644 --- a/lib/src/main/kotlin/org/walletconnect/types/TypeMapConversion.kt +++ b/lib/src/main/kotlin/org/walletconnect/types/TypeMapConversion.kt @@ -46,7 +46,7 @@ fun Session.SessionParams.intoMap(params: MutableMap = mutableMapO fun Map.extractSessionParams(): Session.SessionParams { val approved = this["approved"] as? Boolean ?: throw IllegalArgumentException("approved missing") - val chainId = (this["chainId"] as Double).toLong() + val chainId = (this["chainId"] as? Double)?.toLong() val accounts = nullOnThrow { (this["accounts"] as? List<*>)?.toStringList() } return Session.SessionParams(approved, chainId, accounts, nullOnThrow { this.extractPeerData() })