[Bf-blender-cvs] [8617ab153e2] master: Fix T96352: Gpencil crash using Normalize Thickness with Curves

Antonio Vazquez noreply at git.blender.org
Sat Mar 12 10:33:37 CET 2022


Commit: 8617ab153e25b264651353d82ede6849725ab5f1
Author: Antonio Vazquez
Date:   Sat Mar 12 10:33:32 2022 +0100
Branches: master
https://developer.blender.org/rB8617ab153e25b264651353d82ede6849725ab5f1

Fix T96352: Gpencil crash using Normalize Thickness with Curves

The stroke curve data could be NULL.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 52ce7a7b8e1..47c84d168e9 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -5430,9 +5430,10 @@ static int gpencil_stroke_normalize_exec(bContext *C, wmOperator *op)
           if (ED_gpencil_stroke_can_use(C, gps) == false) {
             continue;
           }
-
-          bool selected = (is_curve_edit) ? gps->editcurve->flag |= GP_CURVE_SELECT :
-                                            (gps->flag & GP_STROKE_SELECT);
+          bool is_curve_ready = (gps->editcurve != NULL);
+          bool selected = (is_curve_edit && is_curve_ready) ?
+                              gps->editcurve->flag |= GP_CURVE_SELECT :
+                              (gps->flag & GP_STROKE_SELECT);
           if (!selected) {
             continue;
           }
@@ -5445,7 +5446,7 @@ static int gpencil_stroke_normalize_exec(bContext *C, wmOperator *op)
           }
 
           /* Loop all Polyline points. */
-          if (!is_curve_edit) {
+          if (!is_curve_edit || !is_curve_ready) {
             for (int i = 0; i < gps->totpoints; i++) {
               bGPDspoint *pt = &gps->points[i];
               if (mode == GP_NORMALIZE_THICKNESS) {



More information about the Bf-blender-cvs mailing list