mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
add exception handling for iperf example's scan when no ap was found
This commit is contained in:
@ -61,6 +61,11 @@ static void scan_done_handler(void* arg, esp_event_base_t event_base,
|
|||||||
wifi_ap_record_t *ap_list_buffer;
|
wifi_ap_record_t *ap_list_buffer;
|
||||||
|
|
||||||
esp_wifi_scan_get_ap_num(&sta_number);
|
esp_wifi_scan_get_ap_num(&sta_number);
|
||||||
|
if (!sta_number) {
|
||||||
|
ESP_LOGE(TAG, "No AP found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ap_list_buffer = malloc(sta_number * sizeof(wifi_ap_record_t));
|
ap_list_buffer = malloc(sta_number * sizeof(wifi_ap_record_t));
|
||||||
if (ap_list_buffer == NULL) {
|
if (ap_list_buffer == NULL) {
|
||||||
ESP_LOGE(TAG, "Failed to malloc buffer to print scan results");
|
ESP_LOGE(TAG, "Failed to malloc buffer to print scan results");
|
||||||
|
Reference in New Issue
Block a user