1
0
forked from drath/libratbag

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

This may make an exception.
This commit is contained in:
Yaroslav Chvanov
2023-03-01 03:57:54 +03:00
parent bc05935322
commit fc80221187
2 changed files with 4 additions and 4 deletions

View File

@@ -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.

View File

@@ -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.