From 4d72a4b3e92dc1e13fbcc773d0adcd1ee44ec7cf Mon Sep 17 00:00:00 2001
From: Thomas Owen James <tom.james@cern.ch>
Date: Mon, 25 Mar 2024 17:41:44 +0100
Subject: [PATCH]  if (orbit <= 0) return;

---
 src/orbit_processor.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/orbit_processor.cc b/src/orbit_processor.cc
index d5fefb9e..36159863 100644
--- a/src/orbit_processor.cc
+++ b/src/orbit_processor.cc
@@ -105,13 +105,13 @@ OrbitProcessor::FillOrbitMetadata OrbitProcessor::FillOrbit(orbit_trailer *trail
   // TODO: we might want to return an empty slice in order to avoid unexepected files/events
   // TODO: to appear and that would let CMSSW crash
   std::pair<uint32_t, bool> orbit_header = std::pair<uint32_t, bool>{ProcessOrbitHeader(rd_ptr)};
+  uint32_t orbit = uint32_t{orbit_header.first};  
+  if (orbit <= 0) return{0, 0, 0};
   //.second is the warning test enable bit
   rd_ptr += 32;  // +32 to account for orbit header
   if (cmsswHeaders) {
     wr_ptr += sizeof(FRDEventHeader_V6) + 4;
   }  // reserving space for cmssw orbit header
-
-  uint32_t orbit = uint32_t{orbit_header.first};
   auto counts = uint32_t{0};
   uint32_t filled_bxs = 0;
   // We loop over the BX map from the orbit trailer and then match the filled
-- 
GitLab