diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2022-03-12 12:33:32 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2022-03-12 12:33:32 +0300 |
commit | 8617ab153e25b264651353d82ede6849725ab5f1 (patch) | |
tree | b1a4c7bbb600205305fcf1c721ea4631ce89592e | |
parent | 39c070ed8f7fb57bf1297177a391b853f33ba59d (diff) |
Fix T96352: Gpencil crash using Normalize Thickness with Curves
The stroke curve data could be NULL.
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 9 |
1 files changed, 5 insertions, 4 deletions
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) { |