From f8309b007c73cfb22147d7e52ad749078fc33edf Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Wed, 7 Jan 2026 01:41:33 -0600 Subject: [PATCH] [zwave_proxy] Add logging if client sends zero-length message (#13052) --- esphome/components/zwave_proxy/zwave_proxy.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/esphome/components/zwave_proxy/zwave_proxy.cpp b/esphome/components/zwave_proxy/zwave_proxy.cpp index c1fde4de6b..f8e0f580e9 100644 --- a/esphome/components/zwave_proxy/zwave_proxy.cpp +++ b/esphome/components/zwave_proxy/zwave_proxy.cpp @@ -182,11 +182,15 @@ void ZWaveProxy::send_frame(const uint8_t *data, size_t length) { ESP_LOGV(TAG, "Skipping sending duplicate response: 0x%02X", data[0]); return; } + if (length && data != nullptr) { #if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERY_VERBOSE - char hex_buf[format_hex_pretty_size(ZWAVE_MAX_LOG_BYTES)]; + char hex_buf[format_hex_pretty_size(ZWAVE_MAX_LOG_BYTES)]; #endif - ESP_LOGVV(TAG, "Sending: %s", format_hex_pretty_to(hex_buf, data, length)); - this->write_array(data, length); + ESP_LOGVV(TAG, "Sending: %s", format_hex_pretty_to(hex_buf, data, length)); + this->write_array(data, length); + } else { + ESP_LOGE(TAG, "Null pointer or length 0"); + } } void ZWaveProxy::send_homeid_changed_msg_(api::APIConnection *conn) {