From f04b461acb0a880fe1308bc93f192a3c5419ccd1 Mon Sep 17 00:00:00 2001 From: Th3maz1ng Date: Sun, 9 Feb 2025 19:07:05 +0100 Subject: [PATCH] BLE: fixed callback not checking if the event queue exists and executing sometimes after the queue was deleted --- .../src/bt/blehost/porting/w800/src/npl_os_freertos.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/W800_SDK_v1.00.10/src/bt/blehost/porting/w800/src/npl_os_freertos.c b/src/W800_SDK_v1.00.10/src/bt/blehost/porting/w800/src/npl_os_freertos.c index 2a25be1..2263be2 100644 --- a/src/W800_SDK_v1.00.10/src/bt/blehost/porting/w800/src/npl_os_freertos.c +++ b/src/W800_SDK_v1.00.10/src/bt/blehost/porting/w800/src/npl_os_freertos.c @@ -248,8 +248,12 @@ os_callout_timer_cb(void *ptmr, void *parg) struct ble_npl_callout *co; co = (struct ble_npl_callout *)parg; - if(co->evq) { - ble_npl_eventq_put(co->evq, &co->ev); + if(co->evq) + { + /* In some cases, the event queue g_eventq_dflt is already + deleted when this callback is called raising an issue ! */ + if(co->evq->q) + ble_npl_eventq_put(co->evq, &co->ev); } else { co->ev.fn(&co->ev); }