diff --git a/esphome/core/automation.h b/esphome/core/automation.h index a89a16aa0a8..af730c35453 100644 --- a/esphome/core/automation.h +++ b/esphome/core/automation.h @@ -101,6 +101,7 @@ template class TemplatableValue { TemplatableValue(TemplatableValue &&other) noexcept : tag_(other.tag_) { if (this->tag_ == VALUE) { new (&this->value_) T(std::move(other.value_)); + other.destroy_(); } else if (this->tag_ == FN) { this->f_ = other.f_; } @@ -126,6 +127,7 @@ template class TemplatableValue { this->tag_ = other.tag_; if (this->tag_ == VALUE) { new (&this->value_) T(std::move(other.value_)); + other.destroy_(); } else if (this->tag_ == FN) { this->f_ = other.f_; }