From 6ca9e166709a6370d006cefb70eb970bfcd06de8 Mon Sep 17 00:00:00 2001 From: Acruid Date: Fri, 6 Sep 2019 10:13:48 -0700 Subject: [PATCH] Changes the interaction system so that if a client sends a UseItemInHand input command while not having a valid attached entity, the handler method will block the command. Previously, the handler method would throw a NullRefException if this occurred. --- .../GameObjects/EntitySystems/Click/InteractionSystem.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index bdb8f4b863..369b17e574 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -261,6 +261,11 @@ namespace Content.Server.GameObjects.EntitySystems var userEntity = ((IPlayerSession) session).AttachedEntity; + if (userEntity == null || !userEntity.IsValid()) + { + return; + } + if (userEntity.TryGetComponent(out CombatModeComponent combatMode) && combatMode.IsInCombatMode) { DoAttack(userEntity, coords, uid);