Skip to content

Commit

Permalink
Merge pull request #46128 from Dr15Jones/fixPythia8Interface
Browse files Browse the repository at this point in the history
Protect getenv in Pythia8Interface
  • Loading branch information
cmsbuild authored Oct 11, 2024
2 parents 6d1fe16 + 08550d4 commit 6da1102
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ namespace gen {

if (ps.exists("useEvtGenPlugin")) {
useEvtGen = true;
string evtgenpath(std::getenv("EVTGENDATA"));
auto env = std::getenv("EVTGENDATA");
if (not env) {
throw cms::Exception("EvtGenMissingEnv") << "The environment variable EVTGENDATA must be defined";
}
string evtgenpath(env);
evtgenDecFile = evtgenpath + string("/DECAY_2010.DEC");
evtgenPdlFile = evtgenpath + string("/evt.pdl");

Expand Down
6 changes: 5 additions & 1 deletion GeneratorInterface/Pythia8Interface/src/Py8InterfaceBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ namespace gen {

if (ps.exists("useEvtGenPlugin")) {
useEvtGen = true;
string evtgenpath(std::getenv("EVTGENDATA"));
auto env = std::getenv("EVTGENDATA");
if (not env) {
throw cms::Exception("EvtGenMissingEnv") << "The environment variable EVTGENDATA must be defined";
}
string evtgenpath(env);
evtgenDecFile = evtgenpath + string("/DECAY_2010.DEC");
evtgenPdlFile = evtgenpath + string("/evt.pdl");

Expand Down

0 comments on commit 6da1102

Please sign in to comment.