summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2021-05-27 16:13:34 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2021-05-27 18:38:06 +0300
commit4d569df95f4c107142184e7145d961823a72232d (patch)
treee7f220518e74415a02c8eb3f491d290c5c3524ed /core
parent364ea7f280a3f074795e542b16b1d0ec76cf6ce2 (diff)
Fixed possible crash in `DynamicBVH::optimize_incremental`
Diffstat (limited to 'core')
-rw-r--r--core/math/dynamic_bvh.cpp5
1 files changed, 4 insertions, 1 deletions
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()) {