From 2c110a9e7e259f9d75625a1c7a6ce661d9c0e390 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 6 Nov 2025 11:57:23 -0600 Subject: [PATCH] preen --- esphome/components/wifi/wifi_component.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index a7a3fb8949..76797f4a7d 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -683,15 +683,15 @@ void WiFiComponent::check_scanning_finished() { log_scan_result(res); } - if (!this->scan_result_[0].get_matches()) { + // Find matching config for on-demand connection params building + const WiFiScanResult &scan_res = this->scan_result_[0]; + + if (!scan_res.get_matches()) { ESP_LOGW(TAG, "No matching network found"); this->retry_connect(); return; } - // Find matching config for on-demand connection params building - const WiFiScanResult &scan_res = this->scan_result_[0]; - for (size_t i = 0; i < this->sta_.size(); i++) { // search for matching STA config, at least one will match (from checks before) if (!scan_res.matches(this->sta_[i])) {