mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	ADE7953: Fix dereferencing of a null pointer (#1086)
* ADE7953: Fix dereferencing of a null pointer The ade7953 driver dereferences a null pointer, when not all of its sensors are used. This gives an exception like: Fatal exception:29 flag:2 (EXCEPTION) epc1:0x4020c241 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000018 depc:0x00000000 * Fix formatting Co-authored-by: olg <x>
This commit is contained in:
		| @@ -18,7 +18,7 @@ void ADE7953::dump_config() { | |||||||
| } | } | ||||||
|  |  | ||||||
| #define ADE_PUBLISH_(name, factor) \ | #define ADE_PUBLISH_(name, factor) \ | ||||||
|   if (name) { \ |   if (name && this->name##_sensor_) { \ | ||||||
|     float value = *name / factor; \ |     float value = *name / factor; \ | ||||||
|     this->name##_sensor_->publish_state(value); \ |     this->name##_sensor_->publish_state(value); \ | ||||||
|   } |   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user