From 1aad09a61d34f5fa4997c2f3c7dd9f9a898c06a2 Mon Sep 17 00:00:00 2001 From: f321x Date: Fri, 27 Mar 2026 15:40:22 +0100 Subject: [PATCH] qt: SettingsDialog: guard self.network access Check if self.network before trying to access it. This would trigger an exception when toggling the trampoline checkbox in offline mode: ``` 29.13 | E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter Traceback (most recent call last): File "/home/user/Documents/electrum/electrum/gui/qt/settings_dialog.py", line 133, in on_trampoline_checked self.network.run_from_another_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'run_from_another_thread' 31.00 | E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter Traceback (most recent call last): File "/home/user/Documents/electrum/electrum/gui/qt/settings_dialog.py", line 131, in on_trampoline_checked self.network.start_gossip() ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'start_gossip' ``` --- electrum/gui/qt/settings_dialog.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index 1655e1710..e06781f19 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -127,11 +127,12 @@ class SettingsDialog(QDialog, QtEventListener): trampoline_cb.setCheckState(Qt.CheckState.Checked) return self.config.LIGHTNING_USE_GOSSIP = not use_trampoline - if not use_trampoline: - self.network.start_gossip() - else: - self.network.run_from_another_thread( - self.network.stop_gossip()) + if self.network: + if not use_trampoline: + self.network.start_gossip() + else: + self.network.run_from_another_thread( + self.network.stop_gossip()) util.trigger_callback('ln_gossip_sync_progress') # FIXME: update all wallet windows util.trigger_callback('channels_updated', self.wallet)