mirror of https://github.com/arendst/Tasmota.git
Add additional chk
This commit is contained in:
parent
5a29fffcc6
commit
46a66c8194
|
@ -535,10 +535,10 @@ void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_l
|
||||||
|
|
||||||
if (Settings.flag4.zigbee_distinct_topics) {
|
if (Settings.flag4.zigbee_distinct_topics) {
|
||||||
char subtopic[TOPSZ];
|
char subtopic[TOPSZ];
|
||||||
if (Settings.flag4.zb_topic_fname && friendlyName) {
|
if (Settings.flag4.zb_topic_fname && friendlyName && strlen(friendlyName)) {
|
||||||
// Clean special characters and check size of friendly name
|
// Clean special characters
|
||||||
char stemp[TOPSZ];
|
char stemp[TOPSZ];
|
||||||
strlcpy(stemp, (!strlen(friendlyName)) ? MQTT_TOPIC : friendlyName, sizeof(stemp));
|
strlcpy(stemp, friendlyName, sizeof(stemp));
|
||||||
MakeValidMqtt(0, stemp);
|
MakeValidMqtt(0, stemp);
|
||||||
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%s"), TasmotaGlobal.mqtt_topic, stemp);
|
snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%s"), TasmotaGlobal.mqtt_topic, stemp);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue