Fix crash drawing polygon curves
[blender.git] / source / blender / editors / curve / editcurve_paint.c
index 0d7cb089c4f6a4aa00d61f2e35bd0dd4229fef1c..36d9f8a4c55cb1be489b0e2c1aa7743811f6e566 100644 (file)
@@ -978,9 +978,16 @@ static int curve_draw_exec(bContext *C, wmOperator *op)
                const struct StrokeElem *selem;
 
                nu->pntsu = stroke_len;
+               nu->pntsv = 1;
                nu->type = CU_POLY;
                nu->bp = MEM_callocN(nu->pntsu * sizeof(BPoint), __func__);
 
+               /* Misc settings. */
+               nu->resolu = cu->resolu;
+               nu->resolv = 1;
+               nu->orderu = 4;
+               nu->orderv = 1;
+               
                BPoint *bp = nu->bp;
 
                BLI_mempool_iternew(cdd->stroke_elem_pool, &iter);