diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-06 03:19:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-06 03:22:00 +0300 |
commit | f6c615a8c287183b59884a24065273f35cb7a578 (patch) | |
tree | 72286eab6ca28c39b2a814741c7caf2d9714ad7f /source | |
parent | ad2e68b8268cdf6a220b46b0dca977fccce7af91 (diff) |
Fix T58819: Weight paint gradient crash
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 21965bb30d8..28f5c1304c8 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -687,13 +687,15 @@ static int paint_weight_gradient_modal(bContext *C, wmOperator *op, const wmEven if (ret & OPERATOR_CANCELLED) { Object *ob = CTX_data_active_object(C); - Mesh *me = ob->data; - if (vert_cache->wpp.wpaint_prev) { - BKE_defvert_array_free_elems(me->dvert, me->totvert); - BKE_defvert_array_copy(me->dvert, vert_cache->wpp.wpaint_prev, me->totvert); - wpaint_prev_destroy(&vert_cache->wpp); + if (vert_cache != NULL) { + Mesh *me = ob->data; + if (vert_cache->wpp.wpaint_prev) { + BKE_defvert_array_free_elems(me->dvert, me->totvert); + BKE_defvert_array_copy(me->dvert, vert_cache->wpp.wpaint_prev, me->totvert); + wpaint_prev_destroy(&vert_cache->wpp); + } + MEM_freeN(vert_cache); } - MEM_freeN(vert_cache); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); |