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:
rnauber 2020-06-15 05:37:15 +02:00 committed by GitHub
parent 9632ac0e02
commit 4fb750de43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,7 +18,7 @@ void ADE7953::dump_config() {
}
#define ADE_PUBLISH_(name, factor) \
if (name) { \
if (name && this->name##_sensor_) { \
float value = *name / factor; \
this->name##_sensor_->publish_state(value); \
}