What changed, and why it matters
This commit fixes a harmless user-interface bug in Electrum's Qt desktop wallet. When running in offline mode, clicking 'Donate to server' in the Help menu caused a crash because the program tried to use a network connection that didn't exist. The fix simply hides that menu item when there is no network. A second small change prevents an extra, unhelpful error message when fetching the built-in Bitcoin whitepaper fails offline.
No security action required. Treat as a normal bug-fix release note item. Users on offline/air-gapped setups will simply no longer see a crash when exploring the Help menu.
Security signals we found
Crash-only UI bug triggered by missing network object
No input validation, parsing, or cryptographic changes
No privilege escalation, data exposure, or remote code execution path
Exception handling change reduces duplicate error dialogs
Evidence from the diff
The patch addresses an AttributeError in electrum/gui/qt/main_window.py: donate_to_server() called self.network.get_donation_address() while self.network is None in offline mode. The fix guards the menu action with if self.network:. It also changes fetch_bitcoin_paper() to raise concurrent.futures.CancelledError when _fetch_tx_from_network returns nothing, so the generic on_error handler does not emit a redundant error dialog after _fetch_tx_from_network already displayed one. There is no security boundary crossed; it is a UX robustness fix.
Changed components
electrum/gui/qt/main_window.py: Help menu constructionelectrum/gui/qt/main_window.py: donate_to_server actionelectrum/gui/qt/main_window.py: fetch_bitcoin_paper helperInspect captured patch +3 / −2
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
index ac51819..59c2507 100644
--- a/electrum/gui/qt/main_window.py
+++ b/electrum/gui/qt/main_window.py
@@ -855,7 +855,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
self.help_menu.addAction(_("&Bitcoin Paper"), self.show_bitcoin_paper)
self.help_menu.addAction(_("&Report Bug"), self.show_report_bug)
self.help_menu.addSeparator()
- self.help_menu.addAction(_("&Donate to server"), self.donate_to_server)
+ if self.network:
+ self.help_menu.addAction(_("&Donate to server"), self.donate_to_server)
run_hook('init_menubar', self)
self.setMenuBar(menubar)
@@ -885,7 +886,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
def fetch_bitcoin_paper():
s = self._fetch_tx_from_network("54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713")
if not s:
- return
+ raise concurrent.futures.CancelledError
s = s.split("0100000000000000")[1:-1]
out = ''.join(x[6:136] + x[138:268] + x[270:400] if len(x) > 136 else x[6:] for x in s)[16:-20]
with open(filename, 'wb') as f:
Why this scored 20/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.