mirror of
https://github.com/esphome/esphome.git
synced 2026-09-25 05:54:01 +00:00
[select] Return StringRef from current_option() (#13095)
This commit is contained in:
@@ -38,7 +38,9 @@ void Select::publish_state(size_t index) {
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *Select::current_option() const { return this->has_state() ? this->option_at(this->active_index_) : ""; }
|
||||
StringRef Select::current_option() const {
|
||||
return this->has_state() ? StringRef(this->option_at(this->active_index_)) : StringRef();
|
||||
}
|
||||
|
||||
void Select::add_on_state_callback(std::function<void(size_t)> &&callback) {
|
||||
this->state_callback_.add(std::move(callback));
|
||||
|
||||
Reference in New Issue
Block a user