Skip to content

Commit

Permalink
Merge pull request #2 from ProjectOpenSea/prashan/casting-fix
Browse files Browse the repository at this point in the history
Fix NPE caused by casting chainId to Double.
  • Loading branch information
prashanOS authored Aug 10, 2022
2 parents 4a32c74 + 1736c87 commit 0caceb5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fun Session.SessionParams.intoMap(params: MutableMap<String, Any?> = mutableMapO

fun Map<String, *>.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() })
Expand Down

0 comments on commit 0caceb5

Please sign in to comment.