Skip to content

Commit

Permalink
fix another null deref in edm4hep reader
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgessinger committed Aug 19, 2024
1 parent 48a26ee commit 3c909ef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Examples/Io/EDM4hep/src/EDM4hepReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,13 @@ ProcessCode EDM4hepReader::read(const AlgorithmContext& ctx) {
SimParticleContainer particlesFinal;
SimParticleContainer particlesGenerator;
for (const auto& inParticle : mcParticleCollection) {
const std::size_t index =
edm4hepParticleMap.find(inParticle.getObjectID().index)->second;
auto particleIt = edm4hepParticleMap.find(inParticle.getObjectID().index);
if (particleIt == edm4hepParticleMap.end()) {
ACTS_ERROR("Particle " << inParticle.getObjectID().index
<< " not found in particle map");
continue;
}
const std::size_t index = particleIt->second;
const auto& particleInitial = unordered.at(index);
if (!inParticle.isCreatedInSimulation()) {
particlesGenerator.insert(particleInitial);
Expand Down

0 comments on commit 3c909ef

Please sign in to comment.