Fix T59519: Grease Pencil stroke with noise modifier crashes blender
authorAntonioya <blendergit@gmail.com>
Tue, 18 Dec 2018 09:24:21 +0000 (10:24 +0100)
committerAntonioya <blendergit@gmail.com>
Tue, 18 Dec 2018 09:24:21 +0000 (10:24 +0100)
The first point index was wrong calculated.

source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c

index 097b57027215f23764336fdf80f606040e100110..722cf861fb1e37bd908a2a1201041681ae86cbff 100644 (file)
@@ -147,10 +147,12 @@ static void deformStroke(
                        pt1 = &gps->points[i - 1];
                }
                else {
+                       int prev_idx = i - 1;
+                       CLAMP_MIN(prev_idx, 0);
                        if (gps->dvert) {
-                               dvert = &gps->dvert[i - 1];
+                               dvert = &gps->dvert[prev_idx];
                        }
-                       pt0 = &gps->points[i - 1];
+                       pt0 = &gps->points[prev_idx];
                        pt1 = &gps->points[i];
 
                }