Skip to content

Commit

Permalink
[Thermo] Check for null species thermo when adding species
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Nov 15, 2016
1 parent 6dc92b6 commit b7fad42
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/thermo/ThermoPhase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ void ThermoPhase::installSlavePhases(XML_Node* phaseNode)

bool ThermoPhase::addSpecies(shared_ptr<Species> spec)
{
if (!spec->thermo) {
throw CanteraError("ThermoPhase::addSpecies",
"Species {} has no thermo data", spec->name);
}
bool added = Phase::addSpecies(spec);
if (added) {
spec->thermo->validate(spec->name);
Expand All @@ -725,6 +729,10 @@ bool ThermoPhase::addSpecies(shared_ptr<Species> spec)

void ThermoPhase::modifySpecies(size_t k, shared_ptr<Species> spec)
{
if (!spec->thermo) {
throw CanteraError("ThermoPhase::modifySpecies",
"Species {} has no thermo data", spec->name);
}
Phase::modifySpecies(k, spec);
if (speciesName(k) != spec->name) {
throw CanteraError("ThermoPhase::modifySpecies",
Expand Down

0 comments on commit b7fad42

Please sign in to comment.