From b07187459b988b97a972a742338f6415afa2e0d0 Mon Sep 17 00:00:00 2001 From: metalgearsloth Date: Sun, 31 Oct 2021 15:24:12 +1100 Subject: [PATCH] Fix physics for invalid parents --- Robust.Shared/GameObjects/Systems/SharedPhysicsSystem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Robust.Shared/GameObjects/Systems/SharedPhysicsSystem.cs b/Robust.Shared/GameObjects/Systems/SharedPhysicsSystem.cs index 9a98c2ece..fe7bf1dc6 100644 --- a/Robust.Shared/GameObjects/Systems/SharedPhysicsSystem.cs +++ b/Robust.Shared/GameObjects/Systems/SharedPhysicsSystem.cs @@ -158,7 +158,9 @@ namespace Robust.Shared.GameObjects angularVelocityDiff += angular; } - if (entity.Transform.Parent!.Owner.TryGetComponent(out PhysicsComponent? newBody)) + var newParent = entity.Transform.Parent?.Owner; + + if (newParent != null && newParent.TryGetComponent(out PhysicsComponent? newBody)) { var (linear, angular) = newBody.MapVelocities;