qt: fix onchain invoice dialog exc for script outputs
What changed, and why it matters
This commit fixes a simple user-interface crash in Electrum's desktop (Qt) wallet. When a user double-clicked a saved invoice that pays to a raw Bitcoin script (rather than a normal address), the invoice details dialog threw an error and failed to open. It is a UI-only bug, not a way to steal funds or bypass security.
No urgent security action required. Treat as a normal bug-fix release item. Users affected by the crash can update to the patched version; no workaround or key rotation is needed.
Security signals we found
UI crash / unhandled exception
NoneType string concatenation error
Defensive null-safe display helper
Evidence from the diff
The patch changes show_onchain_invoice() in electrum/gui/qt/main_window.py to use get_ui_address_str() instead of directly concatenating x.address. For script outputs, address is None, causing a TypeError when building the display string. get_ui_address_str() returns a human-readable placeholder for such outputs, preventing the exception. The fix is local and defensive.
Changed components
electrum/gui/qt/main_window.pyshow_onchain_invoice()Invoice dialog for on-chain payments with script outputsInspect captured patch +2 / −2
### electrum/gui/qt/main_window.py
@@ -1662,9 +1662,9 @@ def show_onchain_invoice(self, invoice: Invoice):
grid.addWidget(QLabel(amount_str), 1, 1)
if len(invoice.outputs) == 1:
grid.addWidget(QLabel(_("Address") + ':'), 2, 0)
- grid.addWidget(QLabel(invoice.get_address()), 2, 1)
+ grid.addWidget(QLabel(invoice.outputs[0].get_ui_address_str()), 2, 1)
else:
- outputs_str = '\n'.join(map(lambda x: x.address + ' : ' + self.format_amount(x.value)+ self.base_unit(), invoice.outputs))
+ outputs_str = '\n'.join(map(lambda x: x.get_ui_address_str() + ' : ' + self.format_amount(x.value) + self.base_unit(), invoice.outputs))
grid.addWidget(QLabel(_("Outputs") + ':'), 2, 0)
grid.addWidget(QLabel(outputs_str), 2, 1)
grid.addWidget(QLabel(_("Description") + ':'), 3, 0)Why this scored 21/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.