[Bf-blender-cvs] [f9d47e92e7d] greasepencil-object: GPencil: Fix crash when Sculpt with Grab brush in an empty frame

Antonio Vazquez noreply at git.blender.org
Tue Feb 25 11:55:28 CET 2020


Commit: f9d47e92e7d1d62db3fd80489d8d6feab4125c7c
Author: Antonio Vazquez
Date:   Tue Feb 25 11:37:16 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rBf9d47e92e7d1d62db3fd80489d8d6feab4125c7c

GPencil: Fix crash when Sculpt with Grab brush in an empty frame

As the copy of the frame is done after the eval data is used, it could be possible the first time the stroke is not available.

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

M	source/blender/editors/gpencil/gpencil_sculpt_paint.c

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

diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 571f9f8e0fc..99aa2399bfc 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -548,6 +548,11 @@ static void gp_brush_grab_apply_cached(tGP_BrushEditData *gso,
                                        const float diff_mat[4][4])
 {
   tGPSB_Grab_StrokeData *data = BLI_ghash_lookup(gso->stroke_customdata, gps);
+  /* If a new frame is created, could be impossible find the stroke. */
+  if (data == NULL) {
+    return;
+  }
+
   int i;
   float inverse_diff_mat[4][4];
   invert_m4_m4(inverse_diff_mat, diff_mat);
@@ -1613,7 +1618,8 @@ static bool gpsculpt_brush_do_frame(bContext *C,
              * 2) Use the points now under the cursor
              */
             gp_brush_grab_stroke_init(gso, gps_active);
-            changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_grab_store_points);
+            changed |= gpsculpt_brush_do_stroke(
+                gso, gps_active, diff_mat, gp_brush_grab_store_points);
           }
           else {
             /* Apply effect to the stored points */



More information about the Bf-blender-cvs mailing list