From de6b20d4954ee7cb29bcc4e2479cd273c6acb0dc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 30 Nov 2025 22:44:30 -0600 Subject: [PATCH] [core] Use StringRef for get_comment and get_compilation_time to avoid allocations --- esphome/core/application.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/core/application.h b/esphome/core/application.h index 98c979b682..8e2035b7c5 100644 --- a/esphome/core/application.h +++ b/esphome/core/application.h @@ -257,7 +257,7 @@ class Application { /// Get the comment of this Application set by pre_setup(). std::string get_comment() const { return this->comment_; } /// Get the comment as StringRef (avoids allocation) - StringRef get_comment_ref() const { return StringRef::from_maybe_nullptr(this->comment_); } + StringRef get_comment_ref() const { return StringRef(this->comment_); } bool is_name_add_mac_suffix_enabled() const { return this->name_add_mac_suffix_; }