Commit: 08e49c034b318fa430f2b783b3a3fac089da5f9b Author: Antonioya Date: Wed Aug 8 12:17:00 2018 +0200 Branches: blender2.8 https://developer.blender.org/rB08e49c034b318fa430f2b783b3a3fac089da5f9b
GP: Fix unreported segment fault with some old files In some corner situations for old files, the weights array could not be initialized properly. =================================================================== M source/blender/blenkernel/intern/gpencil_modifier.c =================================================================== diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 3c2196afb18..d1c455f64e1 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -257,6 +257,11 @@ void BKE_gpencil_simplify_stroke(bGPDstroke *gps, float factor) /* first create temp data and convert points to 2D */ vec2f *points2d = MEM_mallocN(sizeof(vec2f) * gps->totpoints, "GP Stroke temp 2d points"); + /* for some old files, the weights array could not be initializated */ + if (gps->dvert == NULL) { + gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, "gp_stroke_weights"); + } + gpencil_stroke_project_2d(gps->points, gps->totpoints, points2d); gpencil_rdp_stroke(gps, points2d, factor); @@ -271,6 +276,11 @@ void BKE_gpencil_simplify_fixed(bGPDstroke *gps) return; } + /* for some old files, the weights array could not be initializated */ + if (gps->dvert == NULL) { + gps->dvert = MEM_callocN(sizeof(MDeformVert) * gps->totpoints, "gp_stroke_weights"); + } + /* save points */ bGPDspoint *old_points = MEM_dupallocN(gps->points); MDeformVert *old_dvert = MEM_dupallocN(gps->dvert); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs