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.
This commit is contained in:
Jacques Lucke 2022-07-14 09:57:08 +02:00
parent 411bcf1fe7
commit 3935bf255e
Notes: blender-bot 2023-02-14 10:21:15 +01:00
Referenced by issue #99677, Regression: Crash on when Convex Hull node is used on an empty mesh
1 changed files with 8 additions and 4 deletions

View File

@ -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()) {