Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in ExternalLHEProducer in case of earler exception #19549

Merged
merged 1 commit into from Jul 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc
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