Fix physics for invalid parents

This commit is contained in:
metalgearsloth
2021-10-31 15:24:12 +11:00
parent 97fb54b6d7
commit b07187459b

View File

@@ -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;