Commit: 0a724fb441127e8d38daebf2d2fdec2a593a7ec0
Author: Antonio Vazquez
Date:   Tue Aug 20 17:04:51 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0a724fb441127e8d38daebf2d2fdec2a593a7ec0

GPencil: Avoid error when material slot is empty in Convert to

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

M       source/blender/blenkernel/intern/gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index bda825fb4bc..ed9f02cdb35 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -3027,7 +3027,7 @@ static void gpencil_convert_spline(Main *bmain,
     Material *ma_stroke = NULL;
     mat_gp = gpencil_add_from_curve_material(bmain, ob_gp, color, 
gpencil_lines, fill, &r_idx);
     /* If object has more than 1 material, use second material for stroke 
color. */
-    if (ob_cu->totcol > 1) {
+    if ((ob_cu->totcol > 1) && (give_current_material(ob_cu, 2))) {
       ma_stroke = give_current_material(ob_cu, 2);
       linearrgb_to_srgb_v3_v3(mat_gp->gp_style->stroke_rgba, &ma_stroke->r);
       mat_gp->gp_style->stroke_rgba[3] = ma_stroke->a;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to