From 9d4926c942928333ce9436649fe47abd3399003a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 24 Nov 2015 10:07:57 -0800 Subject: Error handling --- public/js/wallet.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'public') diff --git a/public/js/wallet.coffee b/public/js/wallet.coffee index dda576e7..aec62911 100644 --- a/public/js/wallet.coffee +++ b/public/js/wallet.coffee @@ -145,10 +145,13 @@ getAddresses = -> calculateBalance = -> balances = JSON.parse(localStorage.getItem(g.user.username)).balances - balance = balances.reduce (t,s) -> t + s + + balance = balances.length ? balances.reduce (t,s) -> t + s : 0 + g.balance = (balance * multiplier() / 100000000).toFixed(precision()) fiat = (g.balance * g.exchange / multiplier()).toFixed(2) $('#balance').html(g.balance) + $('#balance').parent().fadeIn() $('#fiat').html("#{fiat} #{g.user.currency}") $('#amount').val(g.balance) -- cgit v1.2.3