Skip to content

Commit

Permalink
added token list crash check
Browse files Browse the repository at this point in the history
  • Loading branch information
vnaysngh-mudrex committed May 20, 2024
1 parent 600082d commit cfc22f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/state/lists/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function listToTokenMap(list: TokenList): TokenAddressMap {
})
?.filter((x): x is TagInfo => Boolean(x)) ?? []
const token = new WrappedTokenInfo(tokenInfo, tags)
if (tokenMap[token.chainId][token.address] !== undefined) throw Error('Duplicate tokens.')
if (tokenMap?.[token.chainId]?.[token.address] !== undefined) throw Error('Duplicate tokens.')
return {
...tokenMap,
[token.chainId]: {
Expand Down

0 comments on commit cfc22f4

Please sign in to comment.