Fix #109885: Check if BVH tree is null in correct place
The `BKE_bvhtree_from_pointcloud_get` function have requirements for input point cloud argument and initialization of `BVHTreeFromPointCloud` can be skipped. Due to `BVHTreeFromPointCloud` is not initialized by default constructor, it can contains garbage data. To check if tree is initialized field of `BVHTreeFromPointCloud`, return argument shouldn't be ignored. `[[nodiscard]]` attributes is added. Pull Request: https://projects.blender.org/blender/blender/pulls/109892
This commit is contained in:
committed by
Hans Goudey
parent
5c4694759b
commit
a8186e1542
@@ -247,9 +247,11 @@ typedef struct BVHTreeFromPointCloud {
|
||||
const float (*coords)[3];
|
||||
} BVHTreeFromPointCloud;
|
||||
|
||||
BVHTree *BKE_bvhtree_from_pointcloud_get(struct BVHTreeFromPointCloud *data,
|
||||
const struct PointCloud *pointcloud,
|
||||
int tree_type);
|
||||
#ifdef __cplusplus
|
||||
[[nodiscard]] BVHTree *BKE_bvhtree_from_pointcloud_get(BVHTreeFromPointCloud *data,
|
||||
const PointCloud *pointcloud,
|
||||
int tree_type);
|
||||
#endif
|
||||
|
||||
void free_bvhtree_from_pointcloud(struct BVHTreeFromPointCloud *data);
|
||||
|
||||
|
||||
@@ -1369,9 +1369,9 @@ void free_bvhtree_from_mesh(BVHTreeFromMesh *data)
|
||||
/** \name Point Cloud BVH Building
|
||||
* \{ */
|
||||
|
||||
BVHTree *BKE_bvhtree_from_pointcloud_get(BVHTreeFromPointCloud *data,
|
||||
const PointCloud *pointcloud,
|
||||
const int tree_type)
|
||||
[[nodiscard]] BVHTree *BKE_bvhtree_from_pointcloud_get(BVHTreeFromPointCloud *data,
|
||||
const PointCloud *pointcloud,
|
||||
const int tree_type)
|
||||
{
|
||||
int tot_point = pointcloud->totpoint;
|
||||
BVHTree *tree = bvhtree_new_common(0.0f, tree_type, 6, tot_point, tot_point);
|
||||
|
||||
Reference in New Issue
Block a user