mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
fix(ble/bluedroid): Fixed BLE crash when disable bluedroid host
(cherry picked from commit 9dfa6ab0e9
)
Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -16,6 +16,12 @@ void **btc_profile_cb_tab;
|
|||||||
|
|
||||||
void esp_profile_cb_reset(void)
|
void esp_profile_cb_reset(void)
|
||||||
{
|
{
|
||||||
|
#if BTC_DYNAMIC_MEMORY == TRUE
|
||||||
|
if (btc_profile_cb_tab == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < BTC_PID_NUM; i++) {
|
for (i = 0; i < BTC_PID_NUM; i++) {
|
||||||
@@ -25,6 +31,12 @@ void esp_profile_cb_reset(void)
|
|||||||
|
|
||||||
int btc_profile_cb_set(btc_pid_t profile_id, void *cb)
|
int btc_profile_cb_set(btc_pid_t profile_id, void *cb)
|
||||||
{
|
{
|
||||||
|
#if BTC_DYNAMIC_MEMORY == TRUE
|
||||||
|
if (btc_profile_cb_tab == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (profile_id < 0 || profile_id >= BTC_PID_NUM) {
|
if (profile_id < 0 || profile_id >= BTC_PID_NUM) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -36,6 +48,12 @@ int btc_profile_cb_set(btc_pid_t profile_id, void *cb)
|
|||||||
|
|
||||||
void *btc_profile_cb_get(btc_pid_t profile_id)
|
void *btc_profile_cb_get(btc_pid_t profile_id)
|
||||||
{
|
{
|
||||||
|
#if BTC_DYNAMIC_MEMORY == TRUE
|
||||||
|
if (btc_profile_cb_tab == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (profile_id < 0 || profile_id >= BTC_PID_NUM) {
|
if (profile_id < 0 || profile_id >= BTC_PID_NUM) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user