From 0d5f1dfea0014438ab7c09c1cd21588e79d8de56 Mon Sep 17 00:00:00 2001
From: guhan <guhan.p@globaledgesoft.com>
Date: Fri, 12 Feb 2021 19:49:42 +0530
Subject: [PATCH] Fixed the index issue

---
 openair2/LAYER2/NR_MAC_gNB/config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c
index 8f28424ddb..05ab77735c 100644
--- a/openair2/LAYER2/NR_MAC_gNB/config.c
+++ b/openair2/LAYER2/NR_MAC_gNB/config.c
@@ -423,10 +423,10 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
           ra->preambles.preamble_list = (uint8_t *) malloc(num_preamble*sizeof(uint8_t));
           for(int i=0; i<cc->num_active_ssb; i++) {
             for(int j=0; j<num_preamble; j++) {
-              if (cc->ssb_index[i] == cfra->resources.choice.ssb->ssb_ResourceList.list.array[i]->ssb) {
+              if (cc->ssb_index[i] == cfra->resources.choice.ssb->ssb_ResourceList.list.array[j]->ssb) {
                 // one dedicated preamble for each beam
                 ra->preambles.preamble_list[i] =
-                    cfra->resources.choice.ssb->ssb_ResourceList.list.array[i]->ra_PreambleIndex;
+                    cfra->resources.choice.ssb->ssb_ResourceList.list.array[j]->ra_PreambleIndex;
                 break;
               }
             }
-- 
2.26.2