From a61746045b4af4ec817a269e08085b97be295763 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 26 Sep 2026 01:51:49 +0100 Subject: [PATCH] [core] Pass the copy flag to JsonString explicitly in the StringRef conversion (#19709) --- esphome/core/string_ref.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/core/string_ref.h b/esphome/core/string_ref.h index da07128704..4c0ce28a5a 100644 --- a/esphome/core/string_ref.h +++ b/esphome/core/string_ref.h @@ -279,7 +279,9 @@ inline void convertToJson(const StringRef &src, JsonVariant dst) { dst.set(""); return; } - dst.set(JsonString(src.c_str(), src.size())); + // The explicit isStatic is load bearing: without it clang-tidy reads size() as the bool of the two argument + // constructor and asks for empty() instead + dst.set(JsonString(src.c_str(), src.size(), /* isStatic= */ false)); } #endif // USE_JSON