Skip to content

TypeError: Cannot read property 'toString' of undefined #10553

@sentry

Description

@sentry

Sentry Issue: METAMASK-GN8X

TypeError: Cannot read property 'toString' of undefined
  at bnToHex (app/scripts/lib/util.js:195:31)
  at None (app/scripts/lib/account-tracker.js:289:25)
  at Array.forEach (<anonymous>)
  at callback (app/scripts/lib/account-tracker.js:288:17)
...
(3 additional frame(s) were not displayed)

When using the flaire network as a custom rpc, the results below contains an undefined value for at least one of the users addresses.

const ethContract = this.web3.eth
      .contract(SINGLE_CALL_BALANCES_ABI)
      .at(deployedContractAddress);
    const ethBalance = ['0x0'];

    ethContract.balances(addresses, ethBalance, (error, result) => {

We can likely default the balance to 0 on lines 289 and 290:

        const balance = bnToHex(result[index]);
        accounts[address] = { address, balance };

Metadata

Metadata

Labels

Sev2-normalNormal severity; minor loss of service or inconvenience.type-bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions