tools: don't try to return the first resolution on error

This commit is contained in:
Yaroslav Chvanov
2023-03-01 03:58:58 +03:00
parent fc80221187
commit 11f1ba9f37
2 changed files with 4 additions and 4 deletions

View File

@@ -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):

View File

@@ -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):