commit dfdd0723951fef9166952021410b5664ddff3025
parent 2881565de35b8be6cbac4e54f007ddb89cd7c8ad
Author: ThomasV <thomasv@electrum.org>
Date: Mon, 15 Feb 2016 10:43:57 +0100
kivy: sanitize on_qr
Diffstat:
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py
@@ -240,12 +240,20 @@ class ElectrumWindow(App):
def on_qr(self, data):
if data.startswith('bitcoin:'):
self.set_URI(data)
- else:
- from electrum.bitcoin import base_decode
- from electrum.transaction import Transaction
+ return
+ # try to decode transaction
+ from electrum.bitcoin import base_decode
+ from electrum.transaction import Transaction
+ try:
text = base_decode(data, None, base=43).encode('hex')
tx = Transaction(text)
+ except:
+ tx = None
+ if tx:
self.tx_dialog(tx)
+ return
+ # show error
+ self.show_error("Unable to decode QR data")
def update_tab(self, name):
s = getattr(self, name + '_screen', None)