mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-04 12:44:40 +00:00
fix MQTT crash (#3127)
This commit is contained in:
parent
4ae5443c3b
commit
f2c04c5504
@ -131,7 +131,10 @@ void MQTT::onReceive(char *topic, byte *payload, size_t length)
|
|||||||
}
|
}
|
||||||
delete json_value;
|
delete json_value;
|
||||||
} else {
|
} else {
|
||||||
if (!pb_decode_from_bytes(payload, length, &meshtastic_ServiceEnvelope_msg, &e)) {
|
if (length == 0) {
|
||||||
|
LOG_WARN("Empty MQTT payload received, topic %s!\n", topic);
|
||||||
|
return;
|
||||||
|
} else if (!pb_decode_from_bytes(payload, length, &meshtastic_ServiceEnvelope_msg, &e)) {
|
||||||
LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length);
|
LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!\n", topic, length);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user