[Bf-blender-cvs] [d7b10e5b740] master: Fix T78337: Fix crash when use GPencil merge without materials

Antonio Vazquez noreply at git.blender.org
Sat Jun 27 15:59:44 CEST 2020


Commit: d7b10e5b740fe23f6c713fb9604dcc8b49a83050
Author: Antonio Vazquez
Date:   Sat Jun 27 15:58:45 2020 +0200
Branches: master
https://developer.blender.org/rBd7b10e5b740fe23f6c713fb9604dcc8b49a83050

Fix T78337: Fix crash when use GPencil merge without materials

If the object hadn't material, the index of material was negative.

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

M	source/blender/editors/gpencil/gpencil_merge.c

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

diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c
index e71bf2098dd..6417d31d894 100644
--- a/source/blender/editors/gpencil/gpencil_merge.c
+++ b/source/blender/editors/gpencil/gpencil_merge.c
@@ -132,7 +132,7 @@ static bGPDstroke *gpencil_prepare_stroke(bContext *C, wmOperator *op, int totpo
   bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, CFRA, add_frame_mode);
 
   /* stroke */
-  bGPDstroke *gps = BKE_gpencil_stroke_new(ob->actcol - 1, totpoints, brush->size);
+  bGPDstroke *gps = BKE_gpencil_stroke_new(max(ob->actcol - 1, 0), totpoints, brush->size);
   gps->flag |= GP_STROKE_SELECT;
 
   if (cyclic) {



More information about the Bf-blender-cvs mailing list