diff --git a/Cantera/src/SpeciesThermoFactory.cpp b/Cantera/src/SpeciesThermoFactory.cpp index 4456a3da6..30243ef4b 100755 --- a/Cantera/src/SpeciesThermoFactory.cpp +++ b/Cantera/src/SpeciesThermoFactory.cpp @@ -72,7 +72,8 @@ namespace Cantera { + SHOMATE*ishomate + SIMPLE*isimple); } - SpeciesThermo* SpeciesThermoFactory::newSpeciesThermo(vector nodes) { + SpeciesThermo* SpeciesThermoFactory:: + newSpeciesThermo(vector nodes) { int n = nodes.size(); int inasa = 0, ishomate = 0, isimple = 0; for (int j = 0; j < n; j++) { @@ -83,7 +84,8 @@ namespace Cantera { } - SpeciesThermo* SpeciesThermoFactory::newSpeciesThermoOpt(vector nodes) { + SpeciesThermo* SpeciesThermoFactory:: + newSpeciesThermoOpt(vector nodes) { int n = nodes.size(); int inasa = 0, ishomate = 0, isimple = 0; for (int j = 0; j < n; j++) { @@ -302,7 +304,14 @@ namespace Cantera { void SpeciesThermoFactory:: installThermoForSpecies(int k, const XML_Node& s, SpeciesThermo& spthermo) { - + /* + * Check to see that the species block has a thermo block + * before processing. Throw an error if not there. + */ + if (!(s.hasChild("thermo"))) { + throw UnknownSpeciesThermoModel("installSpecies", + s["name"], ""); + } const XML_Node& thermo = s.child("thermo"); const vector& tp = thermo.children(); int nc = tp.size(); @@ -318,7 +327,8 @@ namespace Cantera { installNasaThermoFromXML(spthermo, k, f, 0); } else { - UnknownSpeciesThermoModel("installSpecies", s["name"], f->name()); + throw UnknownSpeciesThermoModel("installSpecies", + s["name"], f->name()); } } else if (nc == 2) { @@ -331,13 +341,14 @@ namespace Cantera { installShomateThermoFromXML(spthermo, k, f0, f1); } else { - UnknownSpeciesThermoModel("installSpecies", s["name"], - f0->name() + " and " + f1->name()); + throw UnknownSpeciesThermoModel("installSpecies", s["name"], + f0->name() + " and " + + f1->name()); } } else { - UnknownSpeciesThermoModel("installSpecies", s["name"], - "multiple"); + throw UnknownSpeciesThermoModel("installSpecies", s["name"], + "multiple"); } }