diff options
author | Jacques Lucke <jacques@blender.org> | 2022-07-14 10:57:08 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-14 10:57:08 +0300 |
commit | 3935bf255e3313534bc16090aac8118939a1b333 (patch) | |
tree | 72b497be1ddfa4eee9cb057742307eed32bd205a | |
parent | 411bcf1fe7345f2e513b49249c34d3601631a5d7 (diff) |
Fix T99677: crash when convex hull node is used on empty mesh
Fundamental issue is that the attribute api returns none, because
the custom data api returns null for a layer when the size of 0.
This should be improved separately.
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc index 489b618b8be..3394a7cad62 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc @@ -183,8 +183,10 @@ static Mesh *compute_hull(const GeometrySet &geometry_set) const MeshComponent *component = geometry_set.get_component_for_read<MeshComponent>(); const VArray<float3> varray = component->attributes()->lookup<float3>("position", ATTR_DOMAIN_POINT); - varray.materialize(positions.as_mutable_span().slice(offset, varray.size())); - offset += varray.size(); + if (varray) { + varray.materialize(positions.as_mutable_span().slice(offset, varray.size())); + offset += varray.size(); + } } if (geometry_set.has_pointcloud()) { @@ -192,8 +194,10 @@ static Mesh *compute_hull(const GeometrySet &geometry_set) geometry_set.get_component_for_read<PointCloudComponent>(); const VArray<float3> varray = component->attributes()->lookup<float3>("position", ATTR_DOMAIN_POINT); - varray.materialize(positions.as_mutable_span().slice(offset, varray.size())); - offset += varray.size(); + if (varray) { + varray.materialize(positions.as_mutable_span().slice(offset, varray.size())); + offset += varray.size(); + } } if (geometry_set.has_curves()) { |