Merge pull request #60117 from rburing/bullet_area_get_space_nocrash_3.x

This commit is contained in:
Rémi Verschelde 2022-04-11 14:36:45 +02:00 committed by GitHub
commit 38cfdb084b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -253,7 +253,12 @@ void BulletPhysicsServer::area_set_space(RID p_area, RID p_space) {
RID BulletPhysicsServer::area_get_space(RID p_area) const { RID BulletPhysicsServer::area_get_space(RID p_area) const {
AreaBullet *area = area_owner.get(p_area); 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) { void BulletPhysicsServer::area_set_space_override_mode(RID p_area, AreaSpaceOverrideMode p_mode) {