summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2020-12-14 17:11:18 -0800
committerGitHub <noreply@github.com>2020-12-14 17:11:18 -0800
commita1f773d9ed9410667e71cf02829f26fc3eaa68b8 (patch)
tree44d5dd9d72e3342bdf046e072e2986c151dfe380
parentdc473b29e384fcd07abf8512a4f43d5c3975dd91 (diff)
parentc5c13620f23f7275945ef0e4c7b17a014cbfa635 (diff)
Merge pull request #3819 from BennyE/issue3663
Fix for issue 3663 by returning early if no scan was started before s…
-rw-r--r--ports/esp32s2/common-hal/wifi/Radio.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c
index 49cb8ec30..05506783e 100644
--- a/ports/esp32s2/common-hal/wifi/Radio.c
+++ b/ports/esp32s2/common-hal/wifi/Radio.c
@@ -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;