From 46a66c8194be3394bf8cb27a0f3855858c2c5631 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 23 Dec 2020 14:30:09 +0100 Subject: [PATCH] Add additional chk --- tasmota/xdrv_23_zigbee_2a_devices_impl.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tasmota/xdrv_23_zigbee_2a_devices_impl.ino b/tasmota/xdrv_23_zigbee_2a_devices_impl.ino index 115a30dad..b54f2aff1 100644 --- a/tasmota/xdrv_23_zigbee_2a_devices_impl.ino +++ b/tasmota/xdrv_23_zigbee_2a_devices_impl.ino @@ -535,10 +535,10 @@ void Z_Device::jsonPublishAttrList(const char * json_prefix, const Z_attribute_l if (Settings.flag4.zigbee_distinct_topics) { char subtopic[TOPSZ]; - if (Settings.flag4.zb_topic_fname && friendlyName) { - // Clean special characters and check size of friendly name + if (Settings.flag4.zb_topic_fname && friendlyName && strlen(friendlyName)) { + // Clean special characters char stemp[TOPSZ]; - strlcpy(stemp, (!strlen(friendlyName)) ? MQTT_TOPIC : friendlyName, sizeof(stemp)); + strlcpy(stemp, friendlyName, sizeof(stemp)); MakeValidMqtt(0, stemp); snprintf_P(subtopic, sizeof(subtopic), PSTR("%s/%s"), TasmotaGlobal.mqtt_topic, stemp); } else {