From efba0f5fd6b0c42b0644a743da5b9b570a120623 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 14 Apr 2026 14:44:12 -1000 Subject: [PATCH] handle 0 --- esphome/core/helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index ede1640af2..f7bc6c5bee 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -589,7 +589,7 @@ size_t value_accuracy_to_buf(std::span buf, float size_t value_accuracy_with_uom_to_buf(std::span buf, float value, int8_t accuracy_decimals, StringRef unit_of_measurement) { size_t len = value_accuracy_to_buf(buf, value, accuracy_decimals); - if (unit_of_measurement.empty()) { + if (len == 0 || unit_of_measurement.empty()) { return len; } char *end = buf_append_sep_str(buf.data() + len, buf.size() - len, ' ', unit_of_measurement.c_str(),