From ad9d18771e490019716ca94e0cd1b8f38cc9a91a Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 10 Jun 2024 01:53:03 +1200 Subject: [PATCH] Make `MakeAntag()` log errors instead of throwing exceptions (#28771) Make `MakeAntag()` log errors instead of throw --- Content.Server/Antag/AntagSelectionSystem.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Content.Server/Antag/AntagSelectionSystem.cs b/Content.Server/Antag/AntagSelectionSystem.cs index 55c66e8933..d2bc26f20d 100644 --- a/Content.Server/Antag/AntagSelectionSystem.cs +++ b/Content.Server/Antag/AntagSelectionSystem.cs @@ -264,7 +264,7 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem public void MakeAntag(Entity ent, ICommonSession? session, AntagSelectionDefinition def, bool ignoreSpawner = false) { - var antagEnt = (EntityUid?) null; + EntityUid? antagEnt = null; var isSpawner = false; if (session != null) @@ -285,17 +285,16 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem(player, out var spawnerComp)) { Log.Error($"Antag spawner {player} does not have a GhostRoleAntagSpawnerComponent."); + if (session != null) + ent.Comp.SelectedSessions.Remove(session); return; } -- 2.51.2