diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2012-06-14 18:47:41 +0400 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2012-06-14 18:47:41 +0400 |
commit | 43864f9103d726fa3c425afb87d38433a2c01ba6 (patch) | |
tree | 7eb429e0d02ed858bf6719d8e69df46515b2a4bc | |
parent | 931aeeb1f22d06e47357866139ff9c578b64bf7b (diff) |
fix a nullpointer exception when data missing in dae file
-rw-r--r-- | source/blender/collada/ArmatureImporter.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index c58b6f3101d..115f129cb88 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -654,11 +654,17 @@ void ArmatureImporter::make_armatures(bContext *C) 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(); |