From fc80221187e4d6e3dcc104341c2669ae68744e12 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Wed, 1 Mar 2023 03:57:54 +0300 Subject: [PATCH] tools: don't try to return the first profile on error This may make an exception. --- tools/ratbagc.py.in | 4 ++-- tools/ratbagd.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/ratbagc.py.in b/tools/ratbagc.py.in index 51e7989c..4c077f1a 100644 --- a/tools/ratbagc.py.in +++ b/tools/ratbagc.py.in @@ -298,12 +298,12 @@ class RatbagdDevice(metaclass=MetaRatbag): """The currently active profile. This is a non-DBus property computed over the cached list of profiles. In the unlikely case that your device driver is misconfigured and there is no active profile, this returns - the first profile.""" + `None`.""" for profile in self._profiles: if profile.is_active: return profile print("No active profile. Please report this bug to the libratbag developers", file=sys.stderr) - return self._profiles[0] + return None def commit(self): """Commits all changes made to the device. diff --git a/tools/ratbagd.py b/tools/ratbagd.py index ce7e8224..4c192a5e 100644 --- a/tools/ratbagd.py +++ b/tools/ratbagd.py @@ -383,12 +383,12 @@ class RatbagdDevice(_RatbagdDBus): """The currently active profile. This is a non-DBus property computed over the cached list of profiles. In the unlikely case that your device driver is misconfigured and there is no active profile, this returns - the first profile.""" + `None`.""" for profile in self._profiles: if profile.is_active: return profile print("No active profile. Please report this bug to the libratbag developers", file=sys.stderr) - return self._profiles[0] + return None def commit(self): """Commits all changes made to the device.