commit 91b4019d2e3c804262c780cc93ffeb282d538742
parent cff3d6ce31ad2a701f377d406a4826a7299a3868
Author: ThomasV <thomasv@gitorious>
Date: Wed, 11 Jun 2014 18:17:27 +0200
sanitize get_amount
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git 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())