summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ɓukasz Rymanowski <rlukasz@google.com> 2024-04-19 17:11:10 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-04-19 17:11:10 +0000
commit30bd4820e4875b389c37f995f7e9a38769640ea1 (patch)
tree0ab4d85d6926b0a553379af50c66fbf42d64f345
parent74db3d8180eaa2e402e3afef594e3e94e44b410d (diff)
parent27a9748eb26cd77c77cdcb0df564b051df48546d (diff)
Merge "gatt: Fix handling GATT connect timeout" into main
-rw-r--r--system/stack/gatt/gatt_utils.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/system/stack/gatt/gatt_utils.cc b/system/stack/gatt/gatt_utils.cc
index b94969faa4..df545f13fc 100644
--- a/system/stack/gatt/gatt_utils.cc
+++ b/system/stack/gatt/gatt_utils.cc
@@ -1741,16 +1741,13 @@ static void gatt_le_disconnect_complete_notify_user(const RawAddress& bda,
tGATT_DISCONN_REASON reason,
tBT_TRANSPORT transport) {
tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(bda, transport);
- uint8_t tcb_idx = 0;
-
- if (p_tcb) {
- tcb_idx = p_tcb->tcb_idx;
- }
for (uint8_t i = 0; i < GATT_MAX_APPS; i++) {
tGATT_REG* p_reg = &gatt_cb.cl_rcb[i];
if (p_reg->in_use && p_reg->app_cb.p_conn_cb) {
- uint16_t conn_id = GATT_CREATE_CONN_ID(tcb_idx, p_reg->gatt_if);
+ uint16_t conn_id =
+ p_tcb ? GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if)
+ : GATT_INVALID_CONN_ID;
(*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, bda, conn_id,
kGattDisconnected, reason, transport);
}