Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-10-19 18:42:14 +0300
committerHans Goudey <h.goudey@me.com>2021-10-19 18:42:14 +0300
commit7a61916717e3daed8172e679d35fe61bf13f360f (patch)
treef5f674782fb05de93f9212da33b5e421928009da
parenta7ade57e11113a74b11bd0330b073a252ad1c026 (diff)
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.
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
index 4bf856698d9..1c287a0f1bf 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
@@ -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);