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'
```
This commit is contained in:
f321x
2026-03-27 15:40:22 +01:00
parent 3cf2c325d5
commit 1aad09a61d
+6 -5
View File
@@ -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)