mirror of https://github.com/arendst/Tasmota.git
Fix exception on empty topic (#17879)
This commit is contained in:
parent
8bc03bbc06
commit
0ebcf1dc03
|
@ -366,8 +366,7 @@ void ExecuteCommand(const char *cmnd, uint32_t source)
|
||||||
// topicBuf: cmnd/tasmotas/power1 dataBuf: toggle = Mqtt command using a group topic
|
// topicBuf: cmnd/tasmotas/power1 dataBuf: toggle = Mqtt command using a group topic
|
||||||
// topicBuf: cmnd/DVES_83BB10_fb/power1 dataBuf: toggle = Mqtt command using fallback topic
|
// topicBuf: cmnd/DVES_83BB10_fb/power1 dataBuf: toggle = Mqtt command using fallback topic
|
||||||
|
|
||||||
void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len)
|
void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) {
|
||||||
{
|
|
||||||
SHOW_FREE_MEM(PSTR("CommandHandler"));
|
SHOW_FREE_MEM(PSTR("CommandHandler"));
|
||||||
|
|
||||||
bool grpflg = false;
|
bool grpflg = false;
|
||||||
|
@ -408,7 +407,6 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len)
|
||||||
user_index = true;
|
user_index = true;
|
||||||
}
|
}
|
||||||
type[i] = '\0';
|
type[i] = '\0';
|
||||||
}
|
|
||||||
|
|
||||||
bool binary_data = (index > 199); // Suppose binary data on topic index > 199
|
bool binary_data = (index > 199); // Suppose binary data on topic index > 199
|
||||||
if (!binary_data) {
|
if (!binary_data) {
|
||||||
|
@ -435,7 +433,6 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len)
|
||||||
AddLog(LOG_LEVEL_DEBUG, PSTR("CMD: Grp %d, Cmd '%s', Idx %d, Len %d, Pld %d, Data '%s'"),
|
AddLog(LOG_LEVEL_DEBUG, PSTR("CMD: Grp %d, Cmd '%s', Idx %d, Len %d, Pld %d, Data '%s'"),
|
||||||
grpflg, type, index, data_len, payload, (binary_data) ? HexToString((uint8_t*)dataBuf, data_len).c_str() : dataBuf);
|
grpflg, type, index, data_len, payload, (binary_data) ? HexToString((uint8_t*)dataBuf, data_len).c_str() : dataBuf);
|
||||||
|
|
||||||
if (type != nullptr) {
|
|
||||||
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}"));
|
Response_P(PSTR("{\"" D_JSON_COMMAND "\":\"" D_JSON_ERROR "\"}"));
|
||||||
|
|
||||||
if (Settings->ledstate &0x02) { TasmotaGlobal.blinks++; }
|
if (Settings->ledstate &0x02) { TasmotaGlobal.blinks++; }
|
||||||
|
|
Loading…
Reference in New Issue