From 91b4019d2e3c804262c780cc93ffeb282d538742 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 11 Jun 2014 18:17:27 +0200 Subject: [PATCH] sanitize get_amount --- gui/qt/amountedit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gui/qt/amountedit.py b/gui/qt/amountedit.py index f0fa0404b..96bbd1201 100644 --- a/gui/qt/amountedit.py +++ b/gui/qt/amountedit.py @@ -64,11 +64,12 @@ class BTCAmountEdit(AmountEdit): return "BTC" if p == 8 else "mBTC" def get_amount(self): - x = unicode( self.text() ) - if x in['.', '']: + try: + x = Decimal(str(self.text())) + except: return None p = pow(10, self.decimal_point()) - return int( p * Decimal(x) ) + return int( p * x ) def setAmount(self, amount): p = pow(10, self.decimal_point())