diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 924a36dd1e..47775dd43c 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -1847,9 +1847,10 @@ template class CallbackManager { /// Non-template core to avoid code duplication per lambda type. /// Inline fast path; cold growth path is in helpers.cpp via callback_manager_grow(). void add_(CbType cb) { - if (this->size_ == this->capacity_) + if (this->size_ == this->capacity_) { this->data_ = static_cast(callback_manager_grow(this->data_, this->size_, this->capacity_, sizeof(CbType))); + } this->data_[this->size_++] = cb; } CbType *data_{nullptr};