fix bug for 0 transaction wallet
authorMichael Wozniak <github@koh.ms>
Sat, 8 Mar 2014 03:51:58 +0000 (22:51 -0500)
committerMichael Wozniak <github@koh.ms>
Sat, 8 Mar 2014 03:51:58 +0000 (22:51 -0500)
0 transaction wallet would return an error when getting transaction list

plugins/exchange_rate.py

index b8e0062..91d195c 100644 (file)
@@ -344,8 +344,11 @@ class Plugin(BasePlugin):
     def history_tab_update(self):
         if self.config.get('history_rates', 'unchecked') == "checked":
             tx_list = self.tx_list
-            
-            mintimestr = datetime.datetime.fromtimestamp(int(min(tx_list.items(), key=lambda x: x[1]['timestamp'])[1]['timestamp'])).strftime('%Y-%m-%d')
+           
+            try:
+                mintimestr = datetime.datetime.fromtimestamp(int(min(tx_list.items(), key=lambda x: x[1]['timestamp'])[1]['timestamp'])).strftime('%Y-%m-%d')
+            except ValueError:
+                return
             maxtimestr = datetime.datetime.now().strftime('%Y-%m-%d')
             try:
                 resp_hist = self.exchanger.get_json('api.coindesk.com', "/v1/bpi/historical/close.json?start=" + mintimestr + "&end=" + maxtimestr)