[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
Jason C 2021-05-05 17:48:44 -04:00
parent 470913bf27
commit 98f586c8d4
2 changed files with 4 additions and 4 deletions

View File

@ -859,13 +859,13 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// Check whether we can read from the file
if (file.get() == nullptr) {
throw DeadlyImportError("Failed to open IRR file " + pFile);
throw DeadlyImportError("Failed to open IRR file ", pFile);
}
// Construct the irrXML parser
XmlParser st;
if (!st.parse( file.get() )) {
return;
throw DeadlyImportError("XML parse error while loading IRR file ", pFile);
}
pugi::xml_node rootElement = st.getRootNode();

View File

@ -135,12 +135,12 @@ void IRRMeshImporter::InternReadFile(const std::string &pFile,
// Check whether we can read from the file
if (file.get() == NULL)
throw DeadlyImportError("Failed to open IRRMESH file " + pFile);
throw DeadlyImportError("Failed to open IRRMESH file ", pFile);
// Construct the irrXML parser
XmlParser parser;
if (!parser.parse( file.get() )) {
return;
throw DeadlyImportError("XML parse error while loading IRRMESH file ", pFile);
}
XmlNode root = parser.getRootNode();