From 28c50261ac08b1d50c876dbb975e2f6ce4902c1b Mon Sep 17 00:00:00 2001 From: FL-OZ Date: Sun, 10 May 2020 01:47:26 -0500 Subject: [PATCH] Fix a null reference exception (InteractionSystem) that crashed the hell out of the client. --- .../EntitySystems/SharedInteractionSystem.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs index 91947c35c0..aa2f88c01a 100644 --- a/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SharedInteractionSystem.cs @@ -51,13 +51,17 @@ namespace Content.Server.GameObjects.EntitySystems var rayResults = _physicsManager.IntersectRayWithPredicate(coords.MapId, ray, dir.Length, predicate, true); if(!rayResults.DidHitObject || (insideBlockerValid && rayResults.DidHitObject && (rayResults.HitPos - otherCoords).Length < 1f)) { - _mapManager.TryFindGridAt(coords, out var mapGrid); - var srcPos = mapGrid.MapToGrid(coords); - var destPos = new GridCoordinates(otherCoords, mapGrid); - if (srcPos.InRange(_mapManager, destPos, range)) + + if (_mapManager.TryFindGridAt(coords, out var mapGrid) && mapGrid != null) { - return true; + var srcPos = mapGrid.MapToGrid(coords); + var destPos = new GridCoordinates(otherCoords, mapGrid); + if (srcPos.InRange(_mapManager, destPos, range)) + { + return true; + } } + } return false; }