Solaar/lib/solaar
Nick Price 9da66068dc
dbus: do not use the bus in watch_suspend_resume when there is none
The guard read

    if bus is not None and on_resume_callback is not None or on_suspend_callback is not None:

which parses as

    (bus is not None and on_resume_callback is not None) or (on_suspend_callback is not None)

so a caller passing on_suspend_callback entered the body regardless of
whether the bus exists, and bus.add_signal_receiver() raised AttributeError
on None. gtk.py passes both callbacks under --restart-on-wake-up, so that
option crashed on any system without a running system dbus. Test the bus
separately and return early.

The success message was also logged even when no bus was connected.
2026-08-01 11:29:46 -07:00
..
cli
…
ui
…
__init__.py
…
configuration.py
…
custom_logger.py
…
dbus.py
…
gtk.py
…
i18n.py
…
listener.py
…
tasks.py
…
version
…