sanitize get_amount
authorThomasV <thomasv@gitorious>
Wed, 11 Jun 2014 16:17:27 +0000 (18:17 +0200)
committerThomasV <thomasv@gitorious>
Wed, 11 Jun 2014 16:17:27 +0000 (18:17 +0200)
gui/qt/amountedit.py

index f0fa040..96bbd12 100644 (file)
@@ -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())