From eb667866dfde9a227259b0f9bfeaab7fdeaef7ce Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 4 Apr 2008 12:33:01 +0000 Subject: Fix for bug #8870: crash converting curve to mesh. The object was being 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 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern/lattice.c') diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 47175a789b1..479dd38eb89 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -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) -- cgit v1.2.3