Invalid species fallback on spawn/profile validation (#14675)

* if a player's profile has an invalid species, station spawning will always try to fallback to the default humanoid species

* validation always ensures that if a species can't be indexed, the species falls back to the default species
This commit is contained in:
Flipp Syder
2023-03-14 21:47:40 -07:00
committed by GitHub
parent dfcf3c28e7
commit eb04c43db4
2 changed files with 11 additions and 4 deletions

View File

@@ -354,7 +354,11 @@ namespace Content.Shared.Preferences
{
var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
prototypeManager.TryIndex<SpeciesPrototype>(Species, out var speciesPrototype);
if (!prototypeManager.TryIndex<SpeciesPrototype>(Species, out var speciesPrototype))
{
Species = SharedHumanoidAppearanceSystem.DefaultSpecies;
speciesPrototype = prototypeManager.Index<SpeciesPrototype>(Species);
}
var sex = Sex switch
{