diff --git a/ui/app/util.js b/ui/app/util.js index 74e2c19aa..67b7c8f67 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -66,11 +66,11 @@ function weiToEth(bn) { var decimalsToKeep = 4 function formatBalance(balance) { - if (!balance) return 'None' + if (!balance || balance === '0x0') return 'None' var wei = numericBalance(balance) var padded = wei.toString(10) var len = padded.length - var nonZeroIndex = padded.match(/[^0]/).index + var nonZeroIndex = padded.match(/[^0]/) && padded.match(/[^0]/).index var beforeDecimal = padded.substr(nonZeroIndex ? nonZeroIndex : 0, len - 18) var afterDecimal = padded.substr(len - 18, decimalsToKeep) return `${beforeDecimal}.${afterDecimal} ETH`