[Bf-blender-cvs] [7a61916717e] master: Fix T92345: Crash with only pointcloud in attribute transfer node

Hans Goudey noreply at git.blender.org
Tue Oct 19 17:42:53 CEST 2021


Commit: 7a61916717e3daed8172e679d35fe61bf13f360f
Author: Hans Goudey
Date:   Tue Oct 19 10:42:14 2021 -0500
Branches: master
https://developer.blender.org/rB7a61916717e3daed8172e679d35fe61bf13f360f

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.

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc

===================================================================

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);



More information about the Bf-blender-cvs mailing list