Skip to content

Commit

Permalink
fix: initialize MQTT power meter values to zero
Browse files Browse the repository at this point in the history
avoid using uninitialized memory.
  • Loading branch information
schlimmchen committed Jul 22, 2024
1 parent 415c767 commit 5e5a525
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/PowerMeterMqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
bool PowerMeterMqtt::init()
{
auto subscribe = [this](PowerMeterMqttValue const& val, float* targetVariable) {
*targetVariable = 0;
char const* topic = val.Topic;
if (strlen(topic) == 0) { return; }
MqttSettings.subscribe(topic, 0,
Expand Down

0 comments on commit 5e5a525

Please sign in to comment.