From c1f3561a3e19defb022ca796aadeffe653a0f628 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Fri, 12 Jan 2024 22:34:42 +0100 Subject: [PATCH] Fix random crash in Zigbee main page (#20481) --- CHANGELOG.md | 1 + tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1759ce230..d4a39d86f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. - Scripter memory leak in `>w x` (#20473) - ESP8266 GPIO Viewer exception 9 on reading Analog GPIO - GPIO Viewer single instance +- Fix random crash in Zigbee main page ### Removed diff --git a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino index 4870abd00..a27b25e2b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_23_zigbee_A_impl.ino @@ -2335,8 +2335,11 @@ void ZigbeeShow(bool json) WSContentSend_P(PSTR(" 🔅 %d%%"), changeUIntScale(light.getDimmer(),0,254,0,100)); } if (light.validCT() && ((channels == 2) || (channels == 5))) { - uint32_t ct_k = (((1000000 / light.getCT()) + 25) / 50) * 50; - WSContentSend_P(msg[ZB_WEB_LIGHT_CT], light.getCT(), ct_k); + uint16_t ct = light.getCT(); + if (ct != 0) { // ct == 0 means undefined value + uint32_t ct_k = (((1000000 / ct) + 25) / 50) * 50; + WSContentSend_P(msg[ZB_WEB_LIGHT_CT], light.getCT(), ct_k); + } } if (light.validHue() && light.validSat() && (channels >= 3)) { uint8_t r,g,b;