service/upower: do not crash when trying to set power profile without ppd
This commit is contained in:
parent
48a56381a6
commit
3caa174b76
1 changed files with 6 additions and 0 deletions
|
@ -101,6 +101,12 @@ void PowerProfiles::init() {
|
|||
}
|
||||
|
||||
void PowerProfiles::setProfile(PowerProfile::Enum profile) {
|
||||
if (!this->properties.isConnected()) {
|
||||
qCCritical(logPowerProfiles
|
||||
) << "Cannot set power profile: power-profiles-daemon not accessible or not running";
|
||||
return;
|
||||
}
|
||||
|
||||
if (profile == PowerProfile::Performance && !this->bHasPerformanceProfile) {
|
||||
qCCritical(logPowerProfiles
|
||||
) << "Cannot request performance profile as it is not present for this device.";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue