diff --git a/Simulation/ISF/ISF_Core/ISF_Services/src/TruthSvc.cxx b/Simulation/ISF/ISF_Core/ISF_Services/src/TruthSvc.cxx index 6c6363c59edf5dd1097c1bfdf7dca476d375e953..d7b4580cfa96313932a171e02c0cafb0f4d67a60 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/src/TruthSvc.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/src/TruthSvc.cxx @@ -373,17 +373,19 @@ void ISF::TruthSvc::recordIncidentToMCTruth( ISF::ITruthIncident& ti, bool passW } } p = ti.childParticle( i, secBC ); // potentially overrides secBC - // add particle to vertex - vtx->add_particle_out( p); + if (p) { + // add particle to vertex + vtx->add_particle_out( p); #ifdef HEPMC3 - Barcode::ParticleBarcode secBCFromTI = ti.childBarcode(i); - if (secBCFromTI) { - HepMC::suggest_barcode( p, secBCFromTI ); - } - else { - HepMC::suggest_barcode( p, secBC ); - } + Barcode::ParticleBarcode secBCFromTI = ti.childBarcode(i); + if (secBCFromTI) { + HepMC::suggest_barcode( p, secBCFromTI ); + } + else { + HepMC::suggest_barcode( p, secBC ); + } #endif + } } ATH_MSG_VERBOSE ( "Writing out " << i << "th child particle: " << p); } // <-- if write out child particle