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.
This commit is contained in:
Stefan 2026-07-08 05:41:49 -07:00 • committed by GitHub
parent 03a8a2d73d
commit 2e5e53a1b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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