Skip to content

Commit

Permalink
Merge pull request Aircoookie#1101 from droloff/fix-npe
Browse files Browse the repository at this point in the history
check payload to avoid npe
  • Loading branch information
Aircoookie authored Aug 20, 2020
2 parents 7dc1240 + 3b4bccd commit a8c530a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wled00/mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties

DEBUG_PRINT("MQTT msg: ");
DEBUG_PRINTLN(topic);

// paranoia check to avoid npe if no payload
if (payload==nullptr) {
DEBUG_PRINTLN("no payload -> leave");
return;
}
DEBUG_PRINTLN(payload);

//no need to check the topic because we only get topics we are subscribed to
Expand Down

0 comments on commit a8c530a

Please sign in to comment.