fix for crash in 'Skin Armature Create' when the mesh doesnt have any skin data.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 1 Aug 2012 14:37:13 +0000 (14:37 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 1 Aug 2012 14:37:13 +0000 (14:37 +0000)
source/blender/editors/object/object_modifier.c

index cf3e04b84b8798876b0748762ff3a6ed7a096f9a..be69d4ca9eabcd93c591ce906134b6851e9d8478 100644 (file)
@@ -1804,9 +1804,15 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
        Object *ob = CTX_data_active_object(C), *arm_ob;
+       Mesh *me = ob->data;
        ModifierData *skin_md;
        ArmatureModifierData *arm_md;
 
+       if (!CustomData_has_layer(&me->vdata, CD_MVERT_SKIN)) {
+               BKE_reportf(op->reports, RPT_WARNING, "Mesh '%s' has no skin vertex data", me->id.name + 2);
+               return OPERATOR_CANCELLED;
+       }
+
        /* create new armature */
        arm_ob = modifier_skin_armature_create(scene, ob);