From a652985f9a58fae7162359013dbd43e93fac5a70 Mon Sep 17 00:00:00 2001 From: Chen Jian Hua Date: Thu, 12 Dec 2024 12:33:31 +0800 Subject: [PATCH] fix(bt/bluedroid): Fixed failure to get host status when host is not enabled (cherry picked from commit 23455ea9c209c431a05bbaf8fed94335571cb713) Co-authored-by: chenjianhua --- components/bt/host/bluedroid/btc/core/btc_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/bt/host/bluedroid/btc/core/btc_main.c b/components/bt/host/bluedroid/btc/core/btc_main.c index de90708e6b..5fe01627fc 100644 --- a/components/bt/host/bluedroid/btc/core/btc_main.c +++ b/components/bt/host/bluedroid/btc/core/btc_main.c @@ -122,6 +122,11 @@ uint32_t btc_get_ble_status(void) { uint32_t status = BTC_BLE_STATUS_IDLE; + if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) { + BTC_TRACE_ERROR("%s Bluedroid not enabled", __func__); + return status; + } + #if (BLE_INCLUDED == TRUE) // Number of active advertising extern uint8_t btm_ble_adv_active_count(void);