Fix T59648: Linking material to greasepencil object causes crash
authorAntonioya <blendergit@gmail.com>
Thu, 20 Dec 2018 16:14:03 +0000 (17:14 +0100)
committerAntonioya <blendergit@gmail.com>
Thu, 20 Dec 2018 16:14:03 +0000 (17:14 +0100)
source/blender/draw/engines/gpencil/gpencil_draw_utils.c

index a6ef5d6a45af4a20611061843802a538084c600f..8b655854ca179748145f2d28ba7bb7be33a73854 100644 (file)
@@ -1374,6 +1374,11 @@ static void DRW_gpencil_shgroups_create(
                bGPDframe *gpf = elm->gpf;
                bGPDstroke *gps = elm->gps;
                MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
+               /* if the user switch used material from data to object,
+                * the material could not be available */
+               if (gp_style == NULL) {
+                       break;
+               }
 
                /* limit the number of shading groups */
                if (i >= GPENCIL_MAX_SHGROUPS) {