From 43ea0b6356152151ff8939a9b349915cd59b03a3 Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Tue, 17 Mar 2020 23:00:40 +0100 Subject: [PATCH] Fix crash --- tasmota/xdrv_23_zigbee_8_parsers.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasmota/xdrv_23_zigbee_8_parsers.ino b/tasmota/xdrv_23_zigbee_8_parsers.ino index fe0726178..1ca3c3b29 100644 --- a/tasmota/xdrv_23_zigbee_8_parsers.ino +++ b/tasmota/xdrv_23_zigbee_8_parsers.ino @@ -340,7 +340,9 @@ int32_t Z_DataConfirm(int32_t res, const class SBuffer &buf) { char status_message[32]; if (status) { // only report errors - strncpy_P(status_message, (const char*) getZigbeeStatusMessage(status), sizeof(status_message)); + const char * statm = (const char*) getZigbeeStatusMessage(status); + if (nullptr == statm) { statm = PSTR(""); } + strncpy_P(status_message, statm, sizeof(status_message)); status_message[sizeof(status_message)-1] = 0; // truncate if needed, strlcpy is safer but strlcpy_P does not exist Response_P(PSTR("{\"" D_JSON_ZIGBEE_CONFIRM "\":{\"" D_CMND_ZIGBEE_ENDPOINT "\":%d"