Fix server crashing when portal is deleted (#2157)

-Fix server crashing when using the teleporter
This commit is contained in:
Exp
2020-10-01 13:48:42 +02:00
committed by GitHub
parent 155882f469
commit f0cb9f05ee
2 changed files with 5 additions and 3 deletions

View File

@@ -87,7 +87,7 @@ namespace Content.Server.GameObjects.Components.Movement
public void TryChangeState(PortalState targetState)
{
if (Owner == null)
if (Owner == null || Deleted)
{
return;
}
@@ -102,6 +102,9 @@ namespace Content.Server.GameObjects.Components.Movement
private void ReleaseCooldown(IEntity entity)
{
if (Owner == null || Deleted)
return;
if (ImmuneEntities.Contains(entity))
{
ImmuneEntities.Remove(entity);
@@ -189,7 +192,6 @@ namespace Content.Server.GameObjects.Components.Movement
// Departure
// Do we need to rate-limit sounds to stop ear BLAST?
soundPlayer.PlayAtCoords(_departureSound, entity.Transform.Coordinates);
entity.Transform.AttachToGridOrMap();
entity.Transform.Coordinates = position;
soundPlayer.PlayAtCoords(_arrivalSound, entity.Transform.Coordinates);
TryChangeState(PortalState.RecentlyTeleported);