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
Notes: blender-bot 2023-02-14 11:28:39 +01:00
Referenced by commit 4ea92f775e, Fix compile error in recent commit
Referenced by issue #78337, GPencil, edit mode: merge points do nothing
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 1 additions and 1 deletions

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