File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,7 @@ class DBusPropertyGroup: public QObject {
235235 void updateAllDirect ();
236236 void updateAllViaGetAll ();
237237 [[nodiscard]] QString toString () const ;
238+ [[nodiscard]] bool isConnected () const { return this ->interface ; }
238239
239240 void pushPropertyUpdate (DBusPropertyCore* property);
240241 void requestPropertyUpdate (DBusPropertyCore* property);
Original file line number Diff line number Diff line change @@ -101,6 +101,12 @@ void PowerProfiles::init() {
101101}
102102
103103void PowerProfiles::setProfile (PowerProfile::Enum profile) {
104+ if (!this ->properties .isConnected ()) {
105+ qCCritical (logPowerProfiles
106+ ) << " Cannot set power profile: power-profiles-daemon not accessible or not running" ;
107+ return ;
108+ }
109+
104110 if (profile == PowerProfile::Performance && !this ->bHasPerformanceProfile ) {
105111 qCCritical (logPowerProfiles
106112 ) << " Cannot request performance profile as it is not present for this device." ;
You can’t perform that action at this time.
0 commit comments