[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54378] trunk/blender/source/blender/ collada/DocumentImporter.cpp: fix null pointer issue when child nodes reference to unknown/invalid mesh
Gaia Clary
gaia.clary at machinimatrix.org
Fri Feb 8 01:28:58 CET 2013
Revision: 54378
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54378
Author: gaiaclary
Date: 2013-02-08 00:28:58 +0000 (Fri, 08 Feb 2013)
Log Message:
-----------
fix null pointer issue when child nodes reference to unknown/invalid mesh
Modified Paths:
--------------
trunk/blender/source/blender/collada/DocumentImporter.cpp
Modified: trunk/blender/source/blender/collada/DocumentImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/DocumentImporter.cpp 2013-02-08 00:27:35 UTC (rev 54377)
+++ trunk/blender/source/blender/collada/DocumentImporter.cpp 2013-02-08 00:28:58 UTC (rev 54378)
@@ -448,13 +448,23 @@
while (geom_done < geom.getCount()) {
ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map,
material_texture_mapping_map);
- objects_done->push_back(ob);
+ if (ob == NULL) {
+ std::string id = node->getOriginalId();
+ std::string name = node->getName();
+ fprintf(stderr,
+ "<node id=\"%s\", name=\"%s\" >...contains a reference to an unknown instance_mesh.\n",
+ id.c_str(),
+ name.c_str());
+ }
+ else {
+ objects_done->push_back(ob);
+ }
++geom_done;
}
while (camera_done < camera.getCount()) {
ob = create_camera_object(camera[camera_done], sce);
if (ob == NULL) {
- std::string id = node->getOriginalId();
+ std::string id = node->getOriginalId();
std::string name = node->getName();
fprintf(stderr, "<node id=\"%s\", name=\"%s\" >...contains a reference to an unknown instance_camera.\n", id.c_str(), name.c_str());
}
@@ -537,6 +547,7 @@
}
// if node has child nodes write them
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
+ ob = *objects_done->begin();
for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
write_node(child_nodes[i], node, sce, ob, is_library_node);
}
More information about the Bf-blender-cvs
mailing list