From 11f1ba9f3726ec5d00f20d89c1a2746b9d4474ee Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Wed, 1 Mar 2023 03:58:58 +0300 Subject: [PATCH] tools: don't try to return the first resolution on error --- 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 4c077f1a..3f903d21 100644 --- a/tools/ratbagc.py.in +++ b/tools/ratbagc.py.in @@ -419,12 +419,12 @@ class RatbagdProfile(metaclass=MetaRatbag): """The currently active resolution of this profile. This is a non-DBus property computed over the cached list of resolutions. In the unlikely case that your device driver is misconfigured and there is no active - resolution, this returns the first resolution.""" + resolution, this returns `None`.""" for resolution in self._resolutions: if resolution.is_active: return resolution print("No active resolution. Please report this bug to the libratbag developers", file=sys.stderr) - return self._resolutions[0] + return None @property def buttons(self): diff --git a/tools/ratbagd.py b/tools/ratbagd.py index 4c192a5e..df80afa3 100644 --- a/tools/ratbagd.py +++ b/tools/ratbagd.py @@ -530,12 +530,12 @@ class RatbagdProfile(_RatbagdDBus): """The currently active resolution of this profile. This is a non-DBus property computed over the cached list of resolutions. In the unlikely case that your device driver is misconfigured and there is no active - resolution, this returns the first resolution.""" + resolution, this returns `None`.""" for resolution in self._resolutions: if resolution.is_active: return resolution print("No active resolution. Please report this bug to the libratbag developers", file=sys.stderr) - return self._resolutions[0] + return None @GObject.Property def buttons(self):