diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-05-31 21:04:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 21:04:08 +0200 |
commit | 5ec8920cde0cf5aafda59dfda335772acf3fcd15 (patch) | |
tree | f2f5fd46374b058dc8cabbe5e5a5fb09639412fa | |
parent | 0ef18532de58d353d4e430df567892e111837174 (diff) | |
parent | 4d569df95f4c107142184e7145d961823a72232d (diff) |
Merge pull request #49142 from Chaosus/bvh_fix_possible_crash
Fixed possible crash in `DynamicBVH::optimize_incremental`
-rw-r--r-- | core/math/dynamic_bvh.cpp | 5 |
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()) { |