From d11358889e479eb5123a0c24ef0a5b7500ae20d9 Mon Sep 17 00:00:00 2001 From: Leonhard Reichenbach Date: Tue, 18 Apr 2023 16:53:29 +0200 Subject: [PATCH] EventHeader: check size before conversion --- k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp b/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp index 69907d2e..144e1978 100644 --- a/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp +++ b/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp @@ -217,6 +217,10 @@ void EDM4hep2LcioTool::convertEventHeader(const std::string& e4h_coll_name, lcio DataHandle header_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto header_coll = header_handle.get(); + if (header_coll->size() != 1) { + error() << "Header collection contains " << header_coll->size() << " headers, expected 1." << endmsg; + return; + } convEventHeader(header_coll, lcio_event); }