qt: invoice_list: only show invoice if it is not None
What changed, and why it matters
This is a small user-interface bug fix. If a user deletes a payment invoice using the command-line while the graphical wallet window still shows it, clicking to view the deleted invoice previously caused the program to crash with an error. The fix simply checks whether the invoice still exists before trying to display it, and refreshes the list if it does not. There is no security vulnerability here.
No security action needed. Treat as a normal bug fix / UI hardening patch.
Security signals we found
None - this is a UI crash/robustness fix, not a security issue
Evidence from the diff
The patch adds a null/None check in electrum/gui/qt/invoice_list.py’s show_invoice() method. When get_invoice(key) returns None (invoice no longer in wallet), the method now calls self.update() to refresh the GUI list and returns early, instead of proceeding to dereference invoice.is_lightning() and causing an AttributeError/exception. This is a defensive UI robustness fix for a race between CLI deletion and stale GUI state.
Changed components
electrum/gui/qt/invoice_list.pyInvoice details dialog in the Qt GUIInspect captured patch +3 / −0
diff --git a/electrum/gui/qt/invoice_list.py b/electrum/gui/qt/invoice_list.py
index 1acc866..0a56d93 100644
--- a/electrum/gui/qt/invoice_list.py
+++ b/electrum/gui/qt/invoice_list.py
@@ -143,6 +143,9 @@ class InvoiceList(MyTreeView):
def show_invoice(self, key):
invoice = self.wallet.get_invoice(key)
+ if not invoice:
+ self.update()
+ return
if invoice.is_lightning():
self.main_window.show_lightning_invoice(invoice)
else:
Why this scored 18/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.