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.

This commit is contained in:
Acruid
2019-09-06 10:13:48 -07:00
parent deb2b984eb
commit 6ca9e16670

View File

@@ -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);