diff --git a/src/wifi_manager.c b/src/wifi_manager.c index 459a5d0..e126c48 100644 --- a/src/wifi_manager.c +++ b/src/wifi_manager.c @@ -274,6 +274,10 @@ wifi_manager_disable_wps(void) void wifi_manager_stop(void) { + if (!wifi_manager_is_initialized()) + { + return; + } if (!wifiman_msg_send_cmd_stop_and_destroy()) { LOG_ERR("%s failed", "wifiman_msg_send_cmd_stop_and_destroy"); diff --git a/src/wifi_manager_internal.c b/src/wifi_manager_internal.c index 6af51e4..227637b 100644 --- a/src/wifi_manager_internal.c +++ b/src/wifi_manager_internal.c @@ -50,6 +50,16 @@ static os_sema_static_t g_scan_sync_sema_mem; static os_mutex_recursive_t g_p_wifi_mutex; static os_mutex_recursive_static_t g_wifi_manager_mutex_mem; +bool +wifi_manager_is_initialized(void) +{ + if (NULL == g_p_wifi_mutex) + { + return false; + } + return true; +} + void wifi_manager_init_mutex(void) { diff --git a/src/wifi_manager_internal.h b/src/wifi_manager_internal.h index 7b39de1..a7c1f62 100644 --- a/src/wifi_manager_internal.h +++ b/src/wifi_manager_internal.h @@ -85,6 +85,9 @@ extern EventGroupHandle_t g_p_wifi_manager_event_group; extern esp_wps_config_t g_wps_config; extern bool g_wifi_wps_enabled; +bool +wifi_manager_is_initialized(void); + void wifi_manager_init_mutex(void);