Fix T101317: GPencil separate Active layer freezes blender

The error occurs only when the layer is empty.
This commit is contained in:
Antonio Vazquez
2022-09-25 12:26:48 +02:00
parent f68cfd6bb0
commit b6adca3280

View File

@@ -5221,7 +5221,9 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op)
for (int slot = 1; slot <= ob_dst->totcol; slot++) {
while (slot <= ob_dst->totcol && !BKE_object_material_slot_used(ob_dst, slot)) {
ob_dst->actcol = slot;
BKE_object_material_slot_remove(bmain, ob_dst);
if (!BKE_object_material_slot_remove(bmain, ob_dst)) {
break;
}
if (actcol >= slot) {
actcol--;
}