From 099b024a2b31e8be856450bac7e16c1fb9a9cf78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 5 Apr 2022 02:13:04 +0200 Subject: [PATCH] Fix DynamicBVH crash after #59867 I made a wrong assumption that initialization the other pointer in the union would properly initialize the `childs` array. --- core/math/dynamic_bvh.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h index 74831089f3b..50ec2c2b304 100644 --- a/core/math/dynamic_bvh.h +++ b/core/math/dynamic_bvh.h @@ -183,7 +183,7 @@ private: Node *parent = nullptr; union { Node *childs[2]; - void *data = nullptr; + void *data; }; _FORCE_INLINE_ bool is_leaf() const { return childs[1] == nullptr; } @@ -215,7 +215,10 @@ private: return axis.dot(volume.get_center() - org) <= 0; } - Node() {} + Node() { + childs[0] = nullptr; + childs[1] = nullptr; + } }; PagedAllocator node_allocator;