Skip to content

Commit

Permalink
Merge pull request #19549 from Dr15Jones/fixCrashInExternalLHEProducer
Browse files Browse the repository at this point in the history
Fix crash in ExternalLHEProducer in case of earler exception
  • Loading branch information
cmsbuild committed Jul 5, 2017
2 parents 2e75f20 + 10267be commit a56a753
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ExternalLHEProducer : public edm::one::EDProducer<edm::BeginRunProducer,
edm::EndRunProducer> {
public:
explicit ExternalLHEProducer(const edm::ParameterSet& iConfig);
virtual ~ExternalLHEProducer();
virtual ~ExternalLHEProducer() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

Expand All @@ -81,7 +81,7 @@ class ExternalLHEProducer : public edm::one::EDProducer<edm::BeginRunProducer,
void executeScript();
std::unique_ptr<std::string> readOutput();

virtual void nextEvent();
void nextEvent();

// ----------member data ---------------------------
std::string scriptName_;
Expand All @@ -92,7 +92,7 @@ class ExternalLHEProducer : public edm::one::EDProducer<edm::BeginRunProducer,
unsigned int nThreads_{1};
std::string outputContents_;

std::auto_ptr<lhef::LHEReader> reader_;
std::unique_ptr<lhef::LHEReader> reader_;
boost::shared_ptr<lhef::LHERunInfo> runInfoLast;
boost::shared_ptr<lhef::LHERunInfo> runInfo;
boost::shared_ptr<lhef::LHEEvent> partonLevel;
Expand Down Expand Up @@ -267,8 +267,7 @@ ExternalLHEProducer::beginRunProduce(edm::Run& run, edm::EventSetup const& es)

std::vector<std::string> infiles(1, outputFile_);
unsigned int skip = 0;
std::auto_ptr<lhef::LHEReader> thisRead(new lhef::LHEReader(infiles, skip));
reader_ = thisRead;
reader_ = std::make_unique<lhef::LHEReader>(infiles, skip);

nextEvent();
if (runInfoLast) {
Expand Down Expand Up @@ -496,6 +495,7 @@ void ExternalLHEProducer::nextEvent()
if (partonLevel)
return;

if(not reader_) { return;}
partonLevel = reader_->next();
if (!partonLevel)
return;
Expand Down

0 comments on commit a56a753

Please sign in to comment.