Fix potential null pointer use, based on #54094 fix
This commit is contained in:
parent
2a28df82d4
commit
258b5d0019
2 changed files with 6 additions and 2 deletions
|
@ -50,7 +50,9 @@ void CollisionObject2D::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (!disabled || (disable_mode != DISABLE_MODE_REMOVE)) {
|
||||
RID space = get_world_2d()->get_space();
|
||||
Ref<World2D> world_ref = get_world_2d();
|
||||
ERR_FAIL_COND(!world_ref.is_valid());
|
||||
RID space = world_ref->get_space();
|
||||
if (area) {
|
||||
PhysicsServer2D::get_singleton()->area_set_space(rid, space);
|
||||
} else {
|
||||
|
|
|
@ -64,7 +64,9 @@ void CollisionObject3D::_notification(int p_what) {
|
|||
}
|
||||
|
||||
if (!disabled || (disable_mode != DISABLE_MODE_REMOVE)) {
|
||||
RID space = get_world_3d()->get_space();
|
||||
Ref<World3D> world_ref = get_world_3d();
|
||||
ERR_FAIL_COND(!world_ref.is_valid());
|
||||
RID space = world_ref->get_space();
|
||||
if (area) {
|
||||
PhysicsServer3D::get_singleton()->area_set_space(rid, space);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue