From 2e44e459a23a550f1fe6627c68d4cf4663a893e7 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Tue, 13 Feb 2024 03:59:37 -0500 Subject: [PATCH] ui: better checking for setting in record_setting --- lib/solaar/ui/config_panel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/solaar/ui/config_panel.py b/lib/solaar/ui/config_panel.py index 99d2ea30f..6b47b4ea1 100644 --- a/lib/solaar/ui/config_panel.py +++ b/lib/solaar/ui/config_panel.py @@ -827,8 +827,10 @@ def _record_setting(device, setting_class, values): if logger.isEnabledFor(logging.DEBUG): logger.debug('on %s changing setting %s to %s', device, setting_class.name, values) setting = next((s for s in device.settings if s.name == setting_class.name), None) - assert device == setting._device + if setting is None and logger.isEnabledFor(logging.DEBUG): + logger.debug('No setting for %s found on %s when trying to record a change made elsewhere', setting_class.name, device) if setting: + assert device == setting._device if len(values) > 1: setting.update_key_value(values[0], values[-1]) value = {values[0]: values[-1]}