diff --git a/PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc b/PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc index e5da77ce590e2..0a91c694ec94e 100644 --- a/PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc +++ b/PhysicsTools/PatAlgos/plugins/DeDxEstimatorRekeyer.cc @@ -120,8 +120,10 @@ void DeDxEstimatorRekeyer::produce(edm::StreamID, edm::Event& iEvent, const edm: for (const auto& h : pcTrkMap) { std::vector indices(h.first->size(), -1); for (const auto& p : h.second) { - indices[p.first.key()] = resultdedxHitColl->size(); const auto& dedxHit = dedxHitAss[p.second]; + if (dedxHit.isNull()) + continue; + indices[p.first.key()] = resultdedxHitColl->size(); resultdedxHitColl->emplace_back(*dedxHit); momenta.emplace_back(dedxHitMom[dedxHit]); }