Fix for issue 3663 by returning early if no scan was started before stop is issued

This commit is contained in:
BennyE 2020-12-12 00:49:53 +01:00
parent eda3392f50
commit c5c13620f2

View File

@ -105,6 +105,10 @@ mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self) {
}
void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self) {
// Return early if self->current_scan is NULL to avoid hang
if (self->current_scan == NULL) {
return;
}
// Free the memory used to store the found aps.
wifi_scannednetworks_deinit(self->current_scan);
self->current_scan = NULL;