diff options
author | Hans Goudey <h.goudey@me.com> | 2022-11-02 15:59:25 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-11-02 15:59:31 +0300 |
commit | 0fc958a174192b2b25c4187c170ec4a394dc308a (patch) | |
tree | 468dd8f181664c426c3ec19c2268fb3d06173662 /source | |
parent | bc8b15f1a532b078fcc4072295c442d140cdbc06 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.cc | 2 |
1 files changed, 1 insertions, 1 deletions
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<float3> rest_positions = attributes.lookup_or_add_for_write_only_span<float3>("rest_position", ATTR_DOMAIN_POINT); - if (rest_positions) { + if (rest_positions && attributes.domain_size(ATTR_DOMAIN_POINT) > 0) { attributes.lookup<float3>("position").materialize(rest_positions.span); rest_positions.finish(); } |