From 3847b5260b44134401f01f23583cfb4f3a356786 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 23 May 2020 17:46:50 +0200 Subject: [PATCH] Fix exception if you attack and hit nothing. --- .../GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs index 2760463a1e..0275558156 100644 --- a/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Melee/MeleeWeaponComponent.cs @@ -141,7 +141,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee for (var i = 0; i < increments; i++) { var castAngle = new Angle(baseAngle + increment * i); - var res = _physicsManager.IntersectRay(mapId, new CollisionRay(position, castAngle.ToVec(), 23), _range, ignore).First(); + var res = _physicsManager.IntersectRay(mapId, new CollisionRay(position, castAngle.ToVec(), 23), _range, ignore).FirstOrDefault(); if (res.HitEntity != null) { resSet.Add(res.HitEntity);