diff --git a/Content.Server/Chat/Commands/SuicideCommand.cs b/Content.Server/Chat/Commands/SuicideCommand.cs index a7df9d709d..1f1564f379 100644 --- a/Content.Server/Chat/Commands/SuicideCommand.cs +++ b/Content.Server/Chat/Commands/SuicideCommand.cs @@ -88,9 +88,8 @@ namespace Content.Server.Chat.Commands $"{_entities.ToPrettyString(player.AttachedEntity.Value):player} is committing suicide"); // Held item suicide - var handsComponent = _entities.GetComponent(owner); - var itemComponent = handsComponent.GetActiveHandItem; - if (itemComponent != null) + if (_entities.TryGetComponent(owner, out HandsComponent handsComponent) + && handsComponent.GetActiveHandItem is {} itemComponent) { var suicide = _entities.GetComponents(itemComponent.Owner).FirstOrDefault(); @@ -100,6 +99,7 @@ namespace Content.Server.Chat.Commands return; } } + // Get all entities in range of the suicider var entities = EntitySystem.Get().GetEntitiesInRange(owner, 1, LookupFlags.Approximate | LookupFlags.IncludeAnchored).ToArray();