Fix T78855: Knife tool crashes when the geometry has no face
I don't see the need for a BVH Tree to have root but not have leafs. But apparently this case is possible.
This commit is contained in:
parent
f019164f1f
commit
9c9eb03d78
Notes:
blender-bot
2023-05-29 09:17:12 +02:00
Referenced by issue #78855, Knife tool crashes when the geometry has no face
|
@ -1441,13 +1441,13 @@ int *BLI_bvhtree_intersect_plane(BVHTree *tree, float plane[4], uint *r_intersec
|
|||
int *intersect = NULL;
|
||||
size_t total = 0;
|
||||
|
||||
BVHNode *root = tree->nodes[tree->totleaf];
|
||||
if (root != NULL) {
|
||||
if (tree->totleaf) {
|
||||
BVHIntersectPlaneData data;
|
||||
data.tree = tree;
|
||||
copy_v4_v4(data.plane, plane);
|
||||
data.intersect = BLI_stack_new(sizeof(int), __func__);
|
||||
|
||||
BVHNode *root = tree->nodes[tree->totleaf];
|
||||
bvhtree_intersect_plane_dfs_recursive(&data, root);
|
||||
|
||||
total = BLI_stack_count(data.intersect);
|
||||
|
|
Loading…
Reference in New Issue