fixed collada import for objects which have NO children
authorGaia Clary <gaia.clary@machinimatrix.org>
Fri, 8 Feb 2013 12:23:36 +0000 (12:23 +0000)
committerGaia Clary <gaia.clary@machinimatrix.org>
Fri, 8 Feb 2013 12:23:36 +0000 (12:23 +0000)
source/blender/collada/DocumentImporter.cpp

index fa181d4..da19fe1 100644 (file)
@@ -547,9 +547,11 @@ void DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::Node *parent
        }
        // if node has child nodes write them
        COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
        }
        // 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);
+       if (objects_done->size() > 0) {
+               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);
+               }
        }
 }
 
        }
 }