Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c15
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);