From 8055e4bf75faee724cb1694946d0408e0b538691 Mon Sep 17 00:00:00 2001 From: SoulByte Date: Sat, 18 May 2013 15:32:43 +0300 Subject: [PATCH] Bugfix Client will no longer crash by typing "transactions" if it has not made any transactions. --- transactions.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/transactions.py b/transactions.py index ac6d16a..8dd979d 100644 --- a/transactions.py +++ b/transactions.py @@ -19,8 +19,11 @@ def transactions(): else: break data = json.loads(data) - for x in data['payload']['transactions']: - if x['to'] == addr: - print "From: "+x['from']+" "+str(x["amount"]) - if x['from'] == addr: - print "To: "+x['to']+" "+str(x['amount']) + try: + for x in data['payload']['transactions']: + if x['to'] == addr: + print "From: "+x['from']+" "+str(x["amount"]) + if x['from'] == addr: + print "To: "+x['to']+" "+str(x['amount']) + except TypeError: + print "You haven't made any transactions."