Fix T92345: Crash with only pointcloud in attribute transfer node
The distances array is only allocated if there are mesh distances to compare to, so it is empty when there is only a point cloud.
This commit is contained in:
parent
a7ade57e11
commit
7a61916717
Notes:
blender-bot
2023-02-14 02:30:10 +01:00
Referenced by issue #92345, Geometry Nodes: Attribute transfer using "Nearest" mapping causes crash when target geometry consists only of points
|
@ -170,7 +170,9 @@ static void get_closest_pointcloud_points(const PointCloud &pointcloud,
|
|||
BLI_bvhtree_find_nearest(
|
||||
tree_data.tree, position, &nearest, tree_data.nearest_callback, &tree_data);
|
||||
r_indices[i] = nearest.index;
|
||||
r_distances_sq[i] = nearest.dist_sq;
|
||||
if (!r_distances_sq.is_empty()) {
|
||||
r_distances_sq[i] = nearest.dist_sq;
|
||||
}
|
||||
}
|
||||
|
||||
free_bvhtree_from_pointcloud(&tree_data);
|
||||
|
|
Loading…
Reference in New Issue