From 09ad65e2e41432e2b9c5282de1d862ca8f942c1d Mon Sep 17 00:00:00 2001 From: fredlcore Date: Thu, 5 Dec 2024 18:35:32 +0800 Subject: [PATCH] Bugfix --- BSB_LAN/include/mqtt_handler.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/BSB_LAN/include/mqtt_handler.h b/BSB_LAN/include/mqtt_handler.h index 940923fa..c14bed7b 100644 --- a/BSB_LAN/include/mqtt_handler.h +++ b/BSB_LAN/include/mqtt_handler.h @@ -378,8 +378,14 @@ void mqtt_callback(char* topic, byte* passed_payload, unsigned int length) { default: {setmode = 2;break;} } param = parsingStringToParameter(payload); - payload=strchr(payload,'='); - payload++; + if (setmode < 2) { + payload=strchr(payload,'='); + if (payload == NULL) { + printFmtToDebug("MQTT message does not contain '=', discarding...\r\n"); + return; + } + payload++; + } } else { printFmtToDebug("MQTT message not recognized: %s - %s\r\n", topic, payload); return;