summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2021-05-22 18:04:14 +0200
committerGitHub <noreply@github.com>2021-05-22 18:04:14 +0200
commit3c23e026ac2f914ed2afa535854eb55a2af9e40f (patch)
tree1558af6fc0359aa62e43e5844701322e0742b11a
parent97d433a27214e5b3cdac5d0119238d3d6d6e0241 (diff)
parentfea75bb1124cc6e4b507640ce0ca568eb6812edb (diff)
Merge pull request #48973 from trollodel/debug_shapes_update_crash
Fix crash on debug shapes update if CollisionObject3D is not in tree
-rw-r--r--scene/3d/collision_object_3d.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp
index 914b3ad816..cba769a8f8 100644
--- a/scene/3d/collision_object_3d.cpp
+++ b/scene/3d/collision_object_3d.cpp
@@ -215,6 +215,11 @@ void CollisionObject3D::_shape_changed(const Ref<Shape3D> &p_shape) {
}
void CollisionObject3D::_update_debug_shapes() {
+ if (!is_inside_tree()) {
+ debug_shapes_to_update.clear();
+ return;
+ }
+
for (Set<uint32_t>::Element *shapedata_idx = debug_shapes_to_update.front(); shapedata_idx; shapedata_idx = shapedata_idx->next()) {
if (shapes.has(shapedata_idx->get())) {
ShapeData &shapedata = shapes[shapedata_idx->get()];