From 79317f9cb13c0cc85d8f433bd0c7eafb65bc3bb7 Mon Sep 17 00:00:00 2001 From: Ricardo Buring Date: Sun, 10 Apr 2022 22:46:21 +0200 Subject: [PATCH] BulletPhysicsServer::area_get_space: null check This is now the same as e.g. body_get_space. --- modules/bullet/bullet_physics_server.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp index c6aca3904e8..985af955e10 100644 --- a/modules/bullet/bullet_physics_server.cpp +++ b/modules/bullet/bullet_physics_server.cpp @@ -253,7 +253,12 @@ void BulletPhysicsServer::area_set_space(RID p_area, RID p_space) { RID BulletPhysicsServer::area_get_space(RID p_area) const { AreaBullet *area = area_owner.get(p_area); - return area->get_space()->get_self(); + ERR_FAIL_COND_V(!area, RID()); + SpaceBullet *space = area->get_space(); + if (!space) { + return RID(); + } + return space->get_self(); } void BulletPhysicsServer::area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) {