Merge pull request #48973 from trollodel/debug_shapes_update_crash

Fix crash on debug shapes update if CollisionObject3D is not in tree
This commit is contained in:
Rémi Verschelde 2021-05-22 18:04:14 +02:00 committed by GitHub
commit 3c23e026ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()];