mirror of
https://github.com/esphome/esphome.git
synced 2025-11-01 07:31:51 +00:00
make sure no dangling
This commit is contained in:
@@ -191,14 +191,15 @@ void Fan::save_state_() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto traits = this->get_traits();
|
||||||
|
|
||||||
FanRestoreState state{};
|
FanRestoreState state{};
|
||||||
state.state = this->state;
|
state.state = this->state;
|
||||||
state.oscillating = this->oscillating;
|
state.oscillating = this->oscillating;
|
||||||
state.speed = this->speed;
|
state.speed = this->speed;
|
||||||
state.direction = this->direction;
|
state.direction = this->direction;
|
||||||
|
|
||||||
if (this->get_traits().supports_preset_modes() && !this->preset_mode.empty()) {
|
if (traits.supports_preset_modes() && !this->preset_mode.empty()) {
|
||||||
auto traits = this->get_traits();
|
|
||||||
const auto &preset_modes = traits.supported_preset_modes();
|
const auto &preset_modes = traits.supported_preset_modes();
|
||||||
// Store index of current preset mode
|
// Store index of current preset mode
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user