From 2e5e53a1b1452c31451ec88df2d01663d551a3c2 Mon Sep 17 00:00:00 2001 From: Stefan <118777573+spderman3333@users.noreply.github.com> Date: Wed, 8 Jul 2026 05:41:49 -0700 Subject: [PATCH] Fix character slots that exceed the maximum character limit becoming not deletable (#44558) Fixed character slots over the MaxCharacterSlots cvar being impossible to delete directly. Also added a check that should prevent a deletion attempt being made on a slot that does not exist. --- .../Preferences/Managers/ServerPreferencesManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Content.Server/Preferences/Managers/ServerPreferencesManager.cs b/Content.Server/Preferences/Managers/ServerPreferencesManager.cs index bef1ba1beb..e0de585826 100644 --- a/Content.Server/Preferences/Managers/ServerPreferencesManager.cs +++ b/Content.Server/Preferences/Managers/ServerPreferencesManager.cs @@ -300,13 +300,19 @@ namespace Content.Server.Preferences.Managers return; } - if (slot < 0 || slot >= MaxCharacterSlots) + + if (slot < 0) { return; } var curPrefs = prefsData.Prefs!; + if (!curPrefs.Characters.ContainsKey(slot)) + { + return; + } + // If they try to delete the slot they have selected then we switch to another one. // Of course, that's only if they HAVE another slot. int? nextSlot = null;