forked from quickshell/quickshell
		
	service/upower: do not crash when trying to set power profile w/o ppd
This commit is contained in:
		
							parent
							
								
									48a56381a6
								
							
						
					
					
						commit
						cb69c2d016
					
				
					 2 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -235,6 +235,7 @@ public:
 | 
			
		|||
	void updateAllDirect();
 | 
			
		||||
	void updateAllViaGetAll();
 | 
			
		||||
	[[nodiscard]] QString toString() const;
 | 
			
		||||
	[[nodiscard]] bool isConnected() const { return this->interface; }
 | 
			
		||||
 | 
			
		||||
	void pushPropertyUpdate(DBusPropertyCore* property);
 | 
			
		||||
	void requestPropertyUpdate(DBusPropertyCore* property);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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