diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index c018b8030abf6ecfbcad8fa30d32130f3e526024..881a6d7fee494ddc0e86853cea66e28f583b829a 100644
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -915,7 +915,7 @@ static void rrc_gNB_process_RRCReestablishmentComplete(gNB_RRC_INST *rrc, gNB_RR
    * reestablishment, instead of re-requesting the CellGroupConfig from the DU.
    * Hence, add below hack; the solution would be to request the
    * CellGroupConfig from the DU when doing reestablishment. */
-  if (cellGroupConfig->spCellConfig->reconfigurationWithSync != NULL) {
+  if (cellGroupConfig->spCellConfig && cellGroupConfig->spCellConfig->reconfigurationWithSync) {
     ASN_STRUCT_FREE(asn_DEF_NR_ReconfigurationWithSync, cellGroupConfig->spCellConfig->reconfigurationWithSync);
     cellGroupConfig->spCellConfig->reconfigurationWithSync = NULL;
   }