diff options
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 67ffc6adc9f..1331cc92d96 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -1797,6 +1797,11 @@ static int gpencil_vertex_group_invert_exec(bContext *C, wmOperator *op) } CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) { + /* Verify the strokes has something to change. */ + if ((gps->totpoints == 0) || (gps->dvert == NULL)) { + continue; + } + for (int i = 0; i < gps->totpoints; i++) { dvert = &gps->dvert[i]; MDeformWeight *dw = defvert_find_index(dvert, def_nr); @@ -1864,7 +1869,8 @@ static int gpencil_vertex_group_smooth_exec(bContext *C, wmOperator *op) MDeformVert *dverta, *dvertb; CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) { - if (gps->dvert == NULL) { + /* Verify the strokes has something to change. */ + if ((gps->totpoints == 0) || (gps->dvert == NULL)) { continue; } @@ -1959,6 +1965,11 @@ static int gpencil_vertex_group_normalize_exec(bContext *C, wmOperator *op) } CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) { + /* Verify the strokes has something to change. */ + if ((gps->totpoints == 0) || (gps->dvert == NULL)) { + continue; + } + /* look for max value */ float maxvalue = 0.0f; for (int i = 0; i < gps->totpoints; i++) { @@ -2027,10 +2038,11 @@ static int gpencil_vertex_group_normalize_all_exec(bContext *C, wmOperator *op) } CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) { - /* verify the strokes has something to change */ - if (gps->totpoints == 0) { + /* Verify the strokes has something to change. */ + if ((gps->totpoints == 0) || (gps->dvert == NULL)) { continue; } + /* look for tot value */ float *tot_values = MEM_callocN(gps->totpoints * sizeof(float), __func__); |