fix crash when x3d is empty
parent
34f343233e
commit
0b8ed5c03a
|
@ -118,14 +118,16 @@ ColladaParser::ColladaParser(IOSystem *pIOHandler, const std::string &pFile) :
|
|||
}
|
||||
|
||||
// generate a XML reader for it
|
||||
;
|
||||
if (!mXmlParser.parse(daefile.get())) {
|
||||
ThrowException("Unable to read file, malformed XML");
|
||||
}
|
||||
// start reading
|
||||
XmlNode node = mXmlParser.getRootNode();
|
||||
std::string name = node.name();
|
||||
ReadContents(node);
|
||||
XmlNode colladaNode = node.child("COLLADA");
|
||||
if (colladaNode.empty()) {
|
||||
return;
|
||||
}
|
||||
ReadContents(colladaNode);
|
||||
|
||||
// read embedded textures
|
||||
if (zip_archive && zip_archive->isOpen()) {
|
||||
|
|
|
@ -194,6 +194,8 @@ void X3DImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
|
|||
pIOHandler->PushDirectory(slashPos == std::string::npos ? std::string() : pFile.substr(0, slashPos + 1));
|
||||
ParseFile(pFile, pIOHandler);
|
||||
pIOHandler->PopDirectory();
|
||||
if (NodeElement_List.empty())
|
||||
return;
|
||||
//
|
||||
// Assimp use static arrays of objects for fast speed of rendering. That's good, but need some additional operations/
|
||||
// We know that geometry objects(meshes) are stored in <Shape>, also in <Shape>-><Appearance> materials(in Assimp logical view)
|
||||
|
|
Loading…
Reference in New Issue