diff --git a/components/bt/common/btc/core/btc_task.c b/components/bt/common/btc/core/btc_task.c index 08773296c73..2320bf4f85b 100644 --- a/components/bt/common/btc/core/btc_task.c +++ b/components/bt/common/btc/core/btc_task.c @@ -316,6 +316,11 @@ static void btc_thread_handler(void *arg) static bt_status_t btc_task_post(btc_msg_t *msg, uint32_t timeout) { + if (btc_thread == NULL) { + BTC_TRACE_WARNING("%s btc_thread is NULL\n", __func__); + return BT_STATUS_NOT_READY; + } + if (osi_thread_post(btc_thread, btc_thread_handler, msg, 0, timeout) == false) { return BT_STATUS_BUSY; } diff --git a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c index 1f2f6d0906b..6cb4da954d9 100644 --- a/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c +++ b/components/bt/common/btc/profile/esp/blufi/nimble_host/esp_blufi.c @@ -502,6 +502,10 @@ esp_blufi_gap_event(struct ble_gap_event *event, void *arg) blufi_env.aggr_buf = NULL; } + if (!blufi_env.enabled) { + return 0; + } + btc_msg_t msg; esp_blufi_cb_param_t param;