[Thermo] Check for null species thermo when adding species

This commit is contained in:
Ray Speth 2016-11-14 19:46:23 -05:00
parent 6dc92b618f
commit b7fad42cda

View file

@ -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);
@ -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",