diff --git a/esphome/components/ld2410/ld2410.cpp b/esphome/components/ld2410/ld2410.cpp index 71a9c4b8761..0213bf8ea56 100644 --- a/esphome/components/ld2410/ld2410.cpp +++ b/esphome/components/ld2410/ld2410.cpp @@ -733,8 +733,10 @@ void LD2410Component::set_gate_threshold(number::Number *n) { while (gate < TOTAL_GATES && this->gate_move_threshold_numbers_[gate] != n && this->gate_still_threshold_numbers_[gate] != n) gate++; - if (gate == TOTAL_GATES) + if (gate == TOTAL_GATES) { + ESP_LOGW(TAG, "Threshold number is not a known gate"); return; + } number::Number *motionsens = this->gate_move_threshold_numbers_[gate]; number::Number *stillsens = this->gate_still_threshold_numbers_[gate];