From 4d569df95f4c107142184e7145d961823a72232d Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Thu, 27 May 2021 16:13:34 +0300 Subject: Fixed possible crash in `DynamicBVH::optimize_incremental` --- core/math/dynamic_bvh.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp index 200095d8cb..8e596f0f9d 100644 --- a/core/math/dynamic_bvh.cpp +++ b/core/math/dynamic_bvh.cpp @@ -312,8 +312,11 @@ void DynamicBVH::optimize_incremental(int passes) { if (passes < 0) { passes = total_leaves; } - if (bvh_root && (passes > 0)) { + if (passes > 0) { do { + if (!bvh_root) { + break; + } Node *node = bvh_root; unsigned bit = 0; while (node->is_internal()) { -- cgit v1.2.3