test if labels exist before loop. don't raise if a label cannot be converted
This commit is contained in:
parent
5160f46ca1
commit
7e9153aaa4
|
@ -73,7 +73,8 @@ class WalletStorage(object):
|
||||||
raise IOError("Cannot read wallet file '%s'" % self.path)
|
raise IOError("Cannot read wallet file '%s'" % self.path)
|
||||||
self.data = {}
|
self.data = {}
|
||||||
# In old versions of Electrum labels were latin1 encoded, this fixes breakage.
|
# In old versions of Electrum labels were latin1 encoded, this fixes breakage.
|
||||||
for i, label in d['labels'].items():
|
labels = d.get('labels', {})
|
||||||
|
for i, label in labels.items():
|
||||||
try:
|
try:
|
||||||
unicode(label)
|
unicode(label)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
|
@ -83,7 +84,8 @@ class WalletStorage(object):
|
||||||
json.dumps(key)
|
json.dumps(key)
|
||||||
json.dumps(value)
|
json.dumps(value)
|
||||||
except:
|
except:
|
||||||
raise Exception('Failed to convert wallet to 2.x format')
|
print_error('Failed to convert label to json format', key)
|
||||||
|
continue
|
||||||
self.data[key] = value
|
self.data[key] = value
|
||||||
self.file_exists = True
|
self.file_exists = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue