URI: 
       tfix wallet bug in labels plugin - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 5918bac5cb7e935d3140116c82ebefaa8bc35423
   DIR parent a4cb70649d1c1a144f28561a261b237875680094
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Sat, 14 Mar 2015 08:52:21 +0100
       
       fix wallet bug in labels plugin
       
       Diffstat:
         M plugins/labels.py                   |      13 ++++++++++---
       
       1 file changed, 10 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/plugins/labels.py b/plugins/labels.py
       t@@ -225,6 +225,7 @@ class Plugin(BasePlugin):
                if "error" in response:
                    raise BaseException(_("Could not sync labels: %s" % response["error"]))
        
       +        result = {}
                for label in response:
                    try:
                        key = self.decode(label["external_id"])
       t@@ -240,8 +241,14 @@ class Plugin(BasePlugin):
                    except:
                        print_error('error: no json', key)
                        continue
       -            if force or not self.wallet.labels.get(key):
       -                self.wallet.labels[key] = value
       -        self.wallet.storage.put('labels', self.wallet.labels)
       +            result[key] = value
       +
       +        wallet = self.wallet
       +        if not wallet:
       +            return
       +        for key, value in result.items():
       +            if force or not wallet.labels.get(key):
       +                wallet.labels[key] = value
       +        wallet.storage.put('labels', wallet.labels)
                print_error("received %d labels"%len(response))
                self.window.labelsChanged.emit()