diff --git a/system/stack/btm/btm_ble_gap.cc b/system/stack/btm/btm_ble_gap.cc index 39c16514b0feeddf358fbb44e6b459a7632bf223..ce55cf9181e04a8cbe87928f79db7c6c7ed0e48f 100644 --- a/system/stack/btm/btm_ble_gap.cc +++ b/system/stack/btm/btm_ble_gap.cc @@ -1165,6 +1165,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);