From 433c6762c9ee0678959e56f67629370655054500 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sun, 19 Sep 2021 16:53:58 +0200 Subject: [PATCH] Qt Send tab: handle exc when "." is entered into amount_e To reproduce: enter "." to amount_e in Send tab; then click "Save". Traceback (most recent call last): File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 1638, in do_save_invoice self.pending_invoice = self.read_invoice() File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 1625, in read_invoice outputs = self.read_outputs() File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 1501, in read_outputs outputs = self.payto_e.get_outputs(self.max_button.isChecked()) File "/home/user/wspace/electrum/electrum/gui/qt/paytoedit.py", line 235, in get_outputs self.outputs = [PartialTxOutput(scriptpubkey=self.payto_scriptpubkey, value=amount)] File "/home/user/wspace/electrum/electrum/transaction.py", line 1533, in __init__ TxOutput.__init__(self, *args, **kwargs) File "/home/user/wspace/electrum/electrum/transaction.py", line 113, in __init__ raise ValueError(f"bad txout value: {value!r}") ValueError: bad txout value: None --- electrum/gui/qt/paytoedit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/electrum/gui/qt/paytoedit.py b/electrum/gui/qt/paytoedit.py index 2a6262f0e..021023fc0 100644 --- a/electrum/gui/qt/paytoedit.py +++ b/electrum/gui/qt/paytoedit.py @@ -226,12 +226,14 @@ class PayToEdit(CompletionTextEdit, ScanQRTextEdit, Logger): def get_destination_scriptpubkey(self) -> Optional[bytes]: return self.payto_scriptpubkey - def get_outputs(self, is_max): + def get_outputs(self, is_max: bool) -> List[PartialTxOutput]: if self.payto_scriptpubkey: if is_max: amount = '!' else: amount = self.amount_edit.get_amount() + if amount is None: + return [] self.outputs = [PartialTxOutput(scriptpubkey=self.payto_scriptpubkey, value=amount)] return self.outputs[:]