1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-16 06:45:48 +00:00
This commit is contained in:
J. Nick Koston
2025-11-06 17:38:26 -06:00
parent 81bc2d82d6
commit c6da4e4777

View File

@@ -349,10 +349,9 @@ void WiFiComponent::clear_sta() {
WiFiAP WiFiComponent::build_wifi_ap_from_selected_() const { WiFiAP WiFiComponent::build_wifi_ap_from_selected_() const {
WiFiAP params = this->get_sta(); WiFiAP params = this->get_sta();
if (params.get_ssid().empty()) { // PRECONDITION: selected_sta_index_ must be valid (ensured by all callers)
ESP_LOGE(TAG, "No config selected"); // If SSID is empty, it means selected_sta_index_ was invalid - this is a bug
return {}; assert(!params.get_ssid().empty() && "build_wifi_ap_from_selected_() called with invalid selected_sta_index_");
}
// SYNCHRONIZATION: selected_sta_index_ and scan_result_[0] are kept in sync: // SYNCHRONIZATION: selected_sta_index_ and scan_result_[0] are kept in sync:
// - wifi_scan_done() sorts all scan results by priority/RSSI (best first) // - wifi_scan_done() sorts all scan results by priority/RSSI (best first)