From 1c0bd207bbfd6689cbfa250431de518faa6992b5 Mon Sep 17 00:00:00 2001 From: AdrianoDee Date: Wed, 1 Jun 2022 11:00:17 +0200 Subject: [PATCH] Safeguard for nHits==0 --- .../SiPixelRecHits/plugins/SiPixelRecHitSoAFromCUDA.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromCUDA.cc b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromCUDA.cc index fda418320e70a..7532470ebd3d4 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromCUDA.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitSoAFromCUDA.cc @@ -82,7 +82,9 @@ void SiPixelRecHitSoAFromCUDA::acquire(edm::Event const& iEvent, void SiPixelRecHitSoAFromCUDA::produce(edm::Event& iEvent, edm::EventSetup const& es) { auto hmsp = std::make_unique(nMaxModules_ + 1); - std::copy(hitsModuleStart_.get(), hitsModuleStart_.get() + nMaxModules_ + 1, hmsp.get()); + + if (nHits_ > 0) + std::copy(hitsModuleStart_.get(), hitsModuleStart_.get() + nMaxModules_ + 1, hmsp.get()); iEvent.emplace(hostPutToken_, std::move(hmsp)); iEvent.emplace(hitsPutTokenCPU_, store32_.get(), store16_.get(), hitsModuleStart_.get(), nHits_);