diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-21 07:59:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-21 07:59:24 +0400 |
commit | 3ec1daaa77f20e1aeaae30b5beab675659e873f2 (patch) | |
tree | ec941d338f32279f83772450eae3d4200ac28df2 | |
parent | 7233f22e2171d49060a21a46d5f2d2982dabc789 (diff) |
fix [#36234] Dynamic Topology undo crash
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c7f8161c7ed..f67cc0359a2 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4652,13 +4652,18 @@ void sculpt_dynamic_topology_disable(bContext *C, sculptsession_bm_to_me(ob, TRUE); } - BM_mesh_free(ss->bm); - /* Clear data */ me->flag &= ~ME_SCULPT_DYNAMIC_TOPOLOGY; - ss->bm = NULL; - BM_log_free(ss->bm_log); - ss->bm_log = NULL; + + /* typically valid but with global-undo they can be NULL, [#36234] */ + if (ss->bm) { + BM_mesh_free(ss->bm); + ss->bm = NULL; + } + if (ss->bm_log) { + BM_log_free(ss->bm_log); + ss->bm_log = NULL; + } /* Refresh */ sculpt_update_after_dynamic_topology_toggle(C); |