[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47905] trunk/blender/source/blender/ collada/ArmatureImporter.cpp: fix a nullpointer exception when data missing in dae file

Gaia Clary gaia.clary at machinimatrix.org
Thu Jun 14 16:47:42 CEST 2012


Revision: 47905
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47905
Author:   gaiaclary
Date:     2012-06-14 14:47:41 +0000 (Thu, 14 Jun 2012)
Log Message:
-----------
fix a nullpointer exception when data missing in dae file

Modified Paths:
--------------
    trunk/blender/source/blender/collada/ArmatureImporter.cpp

Modified: trunk/blender/source/blender/collada/ArmatureImporter.cpp
===================================================================
--- trunk/blender/source/blender/collada/ArmatureImporter.cpp	2012-06-14 14:43:37 UTC (rev 47904)
+++ trunk/blender/source/blender/collada/ArmatureImporter.cpp	2012-06-14 14:47:41 UTC (rev 47905)
@@ -654,11 +654,17 @@
 		create_armature_bones(skin);
 
 		// link armature with a mesh object
-		Object *ob = mesh_importer->get_object_by_geom_uid(*get_geometry_uid(skin.get_controller_uid()));
-		if (ob)
-			skin.link_armature(C, ob, joint_by_uid, this);
+		const COLLADAFW::UniqueId &uid = skin.get_controller_uid();
+		const COLLADAFW::UniqueId *guid = get_geometry_uid(uid);
+		if (guid != NULL) {
+			Object *ob = mesh_importer->get_object_by_geom_uid(*guid);
+			if (ob)
+				skin.link_armature(C, ob, joint_by_uid, this);
+			else
+				fprintf(stderr, "Cannot find object to link armature with.\n");
+		}
 		else
-			fprintf(stderr, "Cannot find object to link armature with.\n");
+			fprintf(stderr, "Cannot find geometry to link armature with.\n");
 
 		// set armature parent if any
 		Object *par = skin.get_parent();




More information about the Bf-blender-cvs mailing list