From bfe6b55aa706ac5952bd6e887a6e3bfec86de74f Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 20 Jul 2021 15:56:36 -0400 Subject: Fix T89827: Attribute transfer node crash on mesh with no faces Just add a check for whether the mesh has faces when retrieving an attribute on the corner domain. In the future there could be an info message in the node in this case, since maybe it's not intuitive. --- .../nodes/geometry/nodes/node_geo_attribute_transfer.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc index 756f93f154f..6a23443d3ab 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_transfer.cc @@ -370,10 +370,12 @@ static void transfer_attribute_nearest(const GeometrySet &src_geometry, break; } case ATTR_DOMAIN_CORNER: { - use_mesh = true; - mesh_indices.reinitialize(tot_samples); - mesh_distances_sq.reinitialize(tot_samples); - get_closest_mesh_corners(*mesh, dst_positions, mesh_indices, mesh_distances_sq, {}); + if (mesh->totloop > 0) { + use_mesh = true; + mesh_indices.reinitialize(tot_samples); + mesh_distances_sq.reinitialize(tot_samples); + get_closest_mesh_corners(*mesh, dst_positions, mesh_indices, mesh_distances_sq, {}); + } break; } default: { -- cgit v1.2.3