[Bf-blender-cvs] [accf488a350] greasepencil-refactor: GPencil: Fix segment fault in triangulation

Antonio Vazquez noreply at git.blender.org
Sat Jan 18 11:56:11 CET 2020


Commit: accf488a350b619b25d1d4138989a8f7c03cbd67
Author: Antonio Vazquez
Date:   Fri Jan 17 10:04:42 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBaccf488a350b619b25d1d4138989a8f7c03cbd67

GPencil: Fix segment fault in triangulation

If the number of points is < 2, clear the triangles data.

===================================================================

M	source/blender/blenkernel/intern/gpencil.c

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index f577563641a..95b3ff5a1f8 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2809,6 +2809,10 @@ void BKE_gpencil_stroke_geometry_update(bGPDstroke *gps)
   if (gps->totpoints > 2) {
     BKE_gpencil_stroke_fill_triangulate(gps);
   }
+  else {
+    gps->tot_triangles = 0;
+    MEM_SAFE_FREE(gps->triangles);
+  }
 
   /* calc uv data along the stroke */
   BKE_gpencil_stroke_uv_update(gps);



More information about the Bf-blender-cvs mailing list