From 6b9f45c1d1bfafffe6fe251ac7330bc5e5ba8ec2 Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Fri, 30 Sep 2022 15:28:26 -0700 Subject: Sculpt: Fix T101430: Dyntopo undo crash --- source/blender/editors/sculpt_paint/sculpt_dyntopo.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c index 2e3834803c9..a524f84cc6e 100644 --- a/source/blender/editors/sculpt_paint/sculpt_dyntopo.c +++ b/source/blender/editors/sculpt_paint/sculpt_dyntopo.c @@ -147,8 +147,13 @@ static void SCULPT_dynamic_topology_disable_ex( SculptSession *ss = ob->sculpt; Mesh *me = ob->data; - BKE_sculpt_attribute_destroy(ob, ss->attrs.dyntopo_node_id_vertex); - BKE_sculpt_attribute_destroy(ob, ss->attrs.dyntopo_node_id_face); + if (ss->attrs.dyntopo_node_id_vertex) { + BKE_sculpt_attribute_destroy(ob, ss->attrs.dyntopo_node_id_vertex); + } + + if (ss->attrs.dyntopo_node_id_face) { + BKE_sculpt_attribute_destroy(ob, ss->attrs.dyntopo_node_id_face); + } SCULPT_pbvh_clear(ob); -- cgit v1.2.3