tsanitize get_amount - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 91b4019d2e3c804262c780cc93ffeb282d538742 DIR parent cff3d6ce31ad2a701f377d406a4826a7299a3868 HTML Author: ThomasV <thomasv@gitorious> Date: Wed, 11 Jun 2014 18:17:27 +0200 sanitize get_amount Diffstat: M gui/qt/amountedit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- DIR diff --git a/gui/qt/amountedit.py b/gui/qt/amountedit.py t@@ -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())