Skip to content
Snippets Groups Projects
Commit 272a1133 authored by Michael Leyhe's avatar Michael Leyhe
Browse files

BugFix: Check if particle exists instead of using NULL-Pointer and...

parent 9cfb7e40
No related branches found
No related tags found
No related merge requests found
...@@ -75,7 +75,8 @@ bool ParticleTable::clone(std::string newName, std::string oldName) ...@@ -75,7 +75,8 @@ bool ParticleTable::clone(std::string newName, std::string oldName)
Particle* oldParticle = particle(oldName); Particle* oldParticle = particle(oldName);
if (0 == oldParticle) { if (0 == oldParticle) {
Warning << "ParticleTable: cannot clone, " << oldName << " does not exist!" << endmsg; Alert << "ParticleTable: cannot clone, " << oldName << " does not exist!" << endmsg;
exit(1);
return false; return false;
} }
......
...@@ -144,11 +144,15 @@ void AbsChannelEnv::setup(ChannelID id){ ...@@ -144,11 +144,15 @@ void AbsChannelEnv::setup(ChannelID id){
isDecParticle=true; isDecParticle=true;
continue; continue;
} }
if (GlobalEnv::instance()->particleTable()->particle(tmpName) == NULL){
Alert << "Particle " << tmpName << " does not exist in ParticleTable. Please clone an existing particle or add it to the table.";
exit(1);
}
if(isDecParticle){ if(isDecParticle){
daughterParticles.push_back(GlobalEnv::instance()->particleTable()->particle(tmpName)); daughterParticles.push_back(GlobalEnv::instance()->particleTable()->particle(tmpName));
} }
else{ else{
motherParticle = GlobalEnv::instance()->particleTable()->particle(tmpName); motherParticle = GlobalEnv::instance()->particleTable()->particle(tmpName);
} }
} }
std::shared_ptr<AbsDecay> tmpDec; std::shared_ptr<AbsDecay> tmpDec;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment