check payload to avoid npe
This commit is contained in:
parent
39a80f8dc7
commit
3b4bccd0a7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user