From 0fc958a174192b2b25c4187c170ec4a394dc308a Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 2 Nov 2022 13:59:25 +0100 Subject: Fix: Crash adding rest positions to empty mesh The position attribute might not exist when the mesh is empty, which may be another problem, but there is no need to count on it here. --- source/blender/blenkernel/intern/DerivedMesh.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 11ef2b08df4..97ff45e93ce 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -747,7 +747,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, MutableAttributeAccessor attributes = mesh_final->attributes_for_write(); SpanAttributeWriter rest_positions = attributes.lookup_or_add_for_write_only_span("rest_position", ATTR_DOMAIN_POINT); - if (rest_positions) { + if (rest_positions && attributes.domain_size(ATTR_DOMAIN_POINT) > 0) { attributes.lookup("position").materialize(rest_positions.span); rest_positions.finish(); } -- cgit v1.2.3