[irr] Fail if file could not be parsed.
Fail instead of returning empty scene. Partially addresses #3888. TODO: Propagate XML error detail through exception (depends on #3881).pull/3890/head
parent
470913bf27
commit
98f586c8d4
|
@ -859,13 +859,13 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if (file.get() == nullptr) {
|
if (file.get() == nullptr) {
|
||||||
throw DeadlyImportError("Failed to open IRR file " + pFile);
|
throw DeadlyImportError("Failed to open IRR file ", pFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct the irrXML parser
|
// Construct the irrXML parser
|
||||||
XmlParser st;
|
XmlParser st;
|
||||||
if (!st.parse( file.get() )) {
|
if (!st.parse( file.get() )) {
|
||||||
return;
|
throw DeadlyImportError("XML parse error while loading IRR file ", pFile);
|
||||||
}
|
}
|
||||||
pugi::xml_node rootElement = st.getRootNode();
|
pugi::xml_node rootElement = st.getRootNode();
|
||||||
|
|
||||||
|
|
|
@ -135,12 +135,12 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
|
||||||
|
|
||||||
// Check whether we can read from the file
|
// Check whether we can read from the file
|
||||||
if (file.get() == NULL)
|
if (file.get() == NULL)
|
||||||
throw DeadlyImportError("Failed to open IRRMESH file " + pFile);
|
throw DeadlyImportError("Failed to open IRRMESH file ", pFile);
|
||||||
|
|
||||||
// Construct the irrXML parser
|
// Construct the irrXML parser
|
||||||
XmlParser parser;
|
XmlParser parser;
|
||||||
if (!parser.parse( file.get() )) {
|
if (!parser.parse( file.get() )) {
|
||||||
return;
|
throw DeadlyImportError("XML parse error while loading IRRMESH file ", pFile);
|
||||||
}
|
}
|
||||||
XmlNode root = parser.getRootNode();
|
XmlNode root = parser.getRootNode();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue