Fix for bug #8870: crash converting curve to mesh. The object was being
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 4 Apr 2008 12:33:01 +0000 (12:33 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 4 Apr 2008 12:33:01 +0000 (12:33 +0000)
used for curve deform, but after conversion wasn't a curve anymore, and
there was no check for this.

source/blender/blenkernel/intern/lattice.c

index 47175a789b166ca64dddf9fb4eb2f5805f646d9c..479dd38eb899b1920dced36a1d7b1b13ae6ffaa0 100644 (file)
@@ -611,11 +611,16 @@ static int calc_curve_deform(Object *par, float *co, short axis, CurveDeform *cd
 
 void curve_deform_verts(Object *cuOb, Object *target, DerivedMesh *dm, float (*vertexCos)[3], int numVerts, char *vgroup, short defaxis)
 {
-       Curve *cu = cuOb->data;
-       int a, flag = cu->flag;
+       Curve *cu;
+       int a, flag;
        CurveDeform cd;
        int use_vgroups;
-       
+
+       if(cuOb->type != OB_CURVE)
+               return;
+
+       cu = cuOb->data;
+       flag = cu->flag;
        cu->flag |= (CU_PATH|CU_FOLLOW); // needed for path & bevlist
 
        init_curve_deform(cuOb, target, &cd, (cu->flag & CU_STRETCH)==0);
@@ -703,6 +708,11 @@ void curve_deform_vector(Object *cuOb, Object *target, float *orco, float *vec,
        CurveDeform cd;
        float quat[4];
        
+       if(cuOb->type != OB_CURVE) {
+               Mat3One(mat);
+               return;
+       }
+
        init_curve_deform(cuOb, target, &cd, 0);        /* 0 no dloc */
        cd.no_rot_axis= no_rot_axis;                            /* option to only rotate for XY, for example */
        
@@ -730,6 +740,9 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
        int a;
        int use_vgroups;
 
+       if(laOb->type != OB_LATTICE)
+               return;
+
        init_latt_deform(laOb, target);
 
        /* check whether to use vertex groups (only possible if target is a Mesh)