Bladeren bron

[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).
Jason C 4 jaren geleden
bovenliggende
commit
98f586c8d4
2 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 2 2
      code/AssetLib/Irr/IRRLoader.cpp
  2. 2 2
      code/AssetLib/Irr/IRRMeshLoader.cpp

+ 2 - 2
code/AssetLib/Irr/IRRLoader.cpp

@@ -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();
 

+ 2 - 2
code/AssetLib/Irr/IRRMeshLoader.cpp

@@ -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();