diff --git a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitFromCUDA.cc b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitFromCUDA.cc index 790b0da51ecfb..0bad87176ef7a 100644 --- a/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitFromCUDA.cc +++ b/RecoLocalTracker/SiPixelRecHits/plugins/SiPixelRecHitFromCUDA.cc @@ -85,7 +85,8 @@ void SiPixelRecHitFromCUDA::acquire(edm::Event const& iEvent, void SiPixelRecHitFromCUDA::produce(edm::Event& iEvent, edm::EventSetup const& es) { // allocate a buffer for the indices of the clusters auto hmsp = std::make_unique(gpuClustering::maxNumModules + 1); - std::copy(hitsModuleStart_.get(), hitsModuleStart_.get() + gpuClustering::maxNumModules + 1, hmsp.get()); + if (hitsModuleStart_) + std::copy(hitsModuleStart_.get(), hitsModuleStart_.get() + gpuClustering::maxNumModules + 1, hmsp.get()); // wrap the buffer in a HostProduct, and move it to the Event, without reallocating the buffer or affecting hitsModuleStart iEvent.emplace(hostPutToken_, std::move(hmsp));