Early return when there are no wifi scan results (#5797)

This commit is contained in:
Jesse Hills 2023-11-21 14:24:47 +13:00 committed by GitHub
parent cf6b56c1ac
commit e7038d077a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -686,6 +686,11 @@ void WiFiComponent::wifi_process_event_(IDFWiFiEvent *data) {
return; return;
} }
if (it.number == 0) {
// no results
return;
}
uint16_t number = it.number; uint16_t number = it.number;
std::vector<wifi_ap_record_t> records(number); std::vector<wifi_ap_record_t> records(number);
err = esp_wifi_scan_get_ap_records(&number, records.data()); err = esp_wifi_scan_get_ap_records(&number, records.data());