diff --git a/Cantera/src/thermo/ThermoFactory.cpp b/Cantera/src/thermo/ThermoFactory.cpp index 1dedde1f6..7355ae47e 100644 --- a/Cantera/src/thermo/ThermoFactory.cpp +++ b/Cantera/src/thermo/ThermoFactory.cpp @@ -210,14 +210,17 @@ namespace Cantera { ThermoPhase* newPhase(std::string infile, std::string id) { XML_Node* root = get_XML_File(infile); if (id == "-") id = ""; - XML_Node* x = get_XML_Node(string("#")+id, root); - if (x) - return newPhase(*x); + XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id, root); + if (!xphase) { + throw CanteraError("newPhase", + "Couldn't find phase named \"" + id + "\" in file, " + infile); + } + if (xphase) + return newPhase(*xphase); else - return 0; + return (ThermoPhase *) 0; } - /* * Import a phase specification.