Fix T78337: Fix crash when use GPencil merge without materials

If the object hadn't material, the index of material was negative.
This commit is contained in:
Antonio Vazquez
2020-06-27 15:58:45 +02:00
parent 2350159101
commit d7b10e5b74

View File

@@ -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) {