[Bf-blender-cvs] [42d3a160bd9] greasepencil-refactor: GPencil: Fix crash when mask layer is empty

Antonio Vazquez noreply at git.blender.org
Fri Jan 31 19:22:59 CET 2020


Commit: 42d3a160bd953dbbded17d172408dd95afa2d5ec
Author: Antonio Vazquez
Date:   Thu Jan 30 16:59:11 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB42d3a160bd953dbbded17d172408dd95afa2d5ec

GPencil: Fix crash when mask layer is empty

When the layer is empty, the mask framebuffer must be created.

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 4386792d507..73128818748 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -3753,6 +3753,9 @@ void BKE_gpencil_visible_stroke_iter(
     }
 
     if (sta_gpf == NULL && act_gpf == NULL) {
+      if (layer_cb) {
+        layer_cb(gpl, act_gpf, NULL, thunk);
+      }
       continue;
     }
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 2418d5e7abc..4a9aa98c3ce 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -490,7 +490,7 @@ static void gp_layer_cache_populate(bGPDlayer *gpl,
   DRW_shgroup_uniform_float_copy(iter->grp, "strokeIndexOffset", iter->stroke_index_offset);
   DRW_shgroup_stencil_mask(iter->grp, 0xFF);
 
-  bool use_onion = gpf->runtime.onion_id != 0.0f;
+  bool use_onion = gpf && gpf->runtime.onion_id != 0.0f;
   if (use_onion) {
     const bool use_onion_custom_col = (gpd->onion_flag & GP_ONION_GHOST_PREVCOL) != 0;
     const bool use_onion_fade = (gpd->onion_flag & GP_ONION_FADE) != 0;



More information about the Bf-blender-cvs mailing list