diff --git a/system/stack/btm/btm_ble_gap.cc b/system/stack/btm/btm_ble_gap.cc index ff28c2cd19f9860436d4e13c2ee9b203e30614c9..141744023e50bda66eb198c5fec17996e0427923 100644 --- a/system/stack/btm/btm_ble_gap.cc +++ b/system/stack/btm/btm_ble_gap.cc @@ -1180,6 +1180,10 @@ void btm_ble_periodic_adv_sync_lost(uint16_t sync_handle) { LOG_DEBUG("[PSync]: sync_handle = %d", sync_handle); int index = btm_ble_get_psync_index_from_handle(sync_handle); + if (index == MAX_SYNC_TRANSACTION) { + LOG_ERROR("[PSync]: index not found for handle %u", sync_handle); + return; + } tBTM_BLE_PERIODIC_SYNC* ps = &btm_ble_pa_sync_cb.p_sync[index]; ps->sync_lost_cb.Run(sync_handle);