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:
@@ -261,6 +261,11 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
|
|
||||||
var userEntity = ((IPlayerSession) session).AttachedEntity;
|
var userEntity = ((IPlayerSession) session).AttachedEntity;
|
||||||
|
|
||||||
|
if (userEntity == null || !userEntity.IsValid())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (userEntity.TryGetComponent(out CombatModeComponent combatMode) && combatMode.IsInCombatMode)
|
if (userEntity.TryGetComponent(out CombatModeComponent combatMode) && combatMode.IsInCombatMode)
|
||||||
{
|
{
|
||||||
DoAttack(userEntity, coords, uid);
|
DoAttack(userEntity, coords, uid);
|
||||||
|
|||||||
Reference in New Issue
Block a user