From 5b1ce4753babf2985a863d8413c36be22065cba1 Mon Sep 17 00:00:00 2001 From: Pradeep Panigrahi Date: Fri, 22 Jan 2016 14:30:26 +0530 Subject: Bluetooth: Enforce BT state check during GATT operations. Enforce BT state check when BLE Apps call into GATT, to handle scenarios in which delayed call from BLE App to disconnect/close comes after the BT is OFF. This would prevent bluetooth crash in such scenarios. Change-Id: I7bf501abd023e478d25cbe6ee861dfc50eff05db CRs-fixed: 960933 --- btif/src/btif_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c index 1fc263c08..9b4494e05 100644 --- a/btif/src/btif_core.c +++ b/btif/src/btif_core.c @@ -318,11 +318,13 @@ static void bt_jni_msg_ready(void *context) { void btif_sendmsg(void *p_msg) { - thread_post(bt_jni_workqueue_thread, bt_jni_msg_ready, p_msg); + if(bt_jni_workqueue_thread != NULL) + thread_post(bt_jni_workqueue_thread, bt_jni_msg_ready, p_msg); } void btif_thread_post(thread_fn func, void *context) { - thread_post(bt_jni_workqueue_thread, func, context); + if(bt_jni_workqueue_thread != NULL) + thread_post(bt_jni_workqueue_thread, func, context); } static bool fetch_vendor_addr (bt_bdaddr_t *local_addr) -- cgit v1.2.3