Fix GetGridAtmosphere crash

This commit is contained in:
Víctor Aguilera Puerto
2020-08-07 02:33:08 +02:00
parent aa0c8c067e
commit 551c204a9f

View File

@@ -33,8 +33,11 @@ namespace Content.Server.GameObjects.EntitySystems
public IGridAtmosphereComponent? GetGridAtmosphere(GridId gridId)
{
// TODO Return space grid atmosphere for invalid grids or grids with no atmos
var grid = _mapManager.GetGrid(gridId);
var gridEnt = _entityManager.GetEntity(grid.GridEntityId);
if (!_entityManager.TryGetEntity(grid.GridEntityId, out var gridEnt)) return null;
return gridEnt.TryGetComponent(out IGridAtmosphereComponent atmos) ? atmos : null;
}