diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MmDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MmDataPreparator.cxx
index e492b63ba28a7b3aeaf890e9b9442778f6e06e7e..b7fe4807c598bc760e408ad73f3eaeed222e6065 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MmDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MmDataPreparator.cxx
@@ -61,15 +61,18 @@ StatusCode TrigL2MuonSA::MmDataPreparator::prepareData(const TrigRoiDescriptor*
   std::vector<IdentifierHash> mmHashList_cache;
 
   // Get MM container
-  const Muon::MMPrepDataContainer* mmPrds;
+  if(m_mmPrepContainerKey.empty()) {
+    ATH_MSG_INFO("no mmPrepContainerKey");
+    return StatusCode::SUCCESS;
+  }
   auto mmPrepContainerHandle = SG::makeHandle(m_mmPrepContainerKey);
-  mmPrds = mmPrepContainerHandle.cptr();
   if (!mmPrepContainerHandle.isValid()) {
     ATH_MSG_ERROR("Cannot retrieve MM PRD Container key: " << m_mmPrepContainerKey.key());
     return StatusCode::FAILURE;
   } else {
     ATH_MSG_DEBUG("MM PRD Container retrieved with key: " << m_mmPrepContainerKey.key());
   }
+  const Muon::MMPrepDataContainer* mmPrds = mmPrepContainerHandle.cptr();
 
   if (m_use_RoIBasedDataAccess) {
     // ATH_MSG_ERROR("RoI based data access is not available yet");
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/StgcDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/StgcDataPreparator.cxx
index 2d81851310ceecbf5a4d65d2a1d8c17d9bb89763..cfcd83590e00437aaf003a52a028bc3d718e264b 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/StgcDataPreparator.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/StgcDataPreparator.cxx
@@ -61,15 +61,18 @@ StatusCode TrigL2MuonSA::StgcDataPreparator::prepareData(const TrigRoiDescriptor
   std::vector<IdentifierHash> stgcHashList_cache;
 
   // Get sTGC container
-  const Muon::sTgcPrepDataContainer* stgcPrds;
+  if(m_stgcPrepContainerKey.empty()) {
+    ATH_MSG_INFO("no stgcPrepContainerKey");
+    return StatusCode::SUCCESS;
+  }
   auto stgcPrepContainerHandle = SG::makeHandle(m_stgcPrepContainerKey);
-  stgcPrds = stgcPrepContainerHandle.cptr();
   if (!stgcPrepContainerHandle.isValid()) {
     ATH_MSG_ERROR("Cannot retrieve sTgc PRD Container key: " << m_stgcPrepContainerKey.key());
     return StatusCode::FAILURE;
   } else {
     ATH_MSG_DEBUG("sTgc PRD Container retrieved with key: " << m_stgcPrepContainerKey.key());
   }
+  const Muon::sTgcPrepDataContainer* stgcPrds = stgcPrepContainerHandle.cptr();
 
   if (m_use_RoIBasedDataAccess) {
     // ATH_MSG_ERROR("RoI based data access is not available yet");