diff options
author | trollodel <33117082+trollodel@users.noreply.github.com> | 2021-05-22 17:23:11 +0200 |
---|---|---|
committer | trollodel <33117082+trollodel@users.noreply.github.com> | 2021-05-22 17:26:03 +0200 |
commit | fea75bb1124cc6e4b507640ce0ca568eb6812edb (patch) | |
tree | 5a03e4f059e8804c35409c20829ffdf619013502 /scene/3d/collision_object_3d.cpp | |
parent | 78861fde0b383e5fe361e73a451bf58ef117c20f (diff) |
Fix crash on debug shapes update if CollisionObject3D is not in tree
Diffstat (limited to 'scene/3d/collision_object_3d.cpp')
-rw-r--r-- | scene/3d/collision_object_3d.cpp | 5 |
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()]; |