diff --git a/Content.Server/Station/Systems/StationSpawningSystem.cs b/Content.Server/Station/Systems/StationSpawningSystem.cs index 9beccd06df..7e19b5f362 100644 --- a/Content.Server/Station/Systems/StationSpawningSystem.cs +++ b/Content.Server/Station/Systems/StationSpawningSystem.cs @@ -182,10 +182,13 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem if (!InventorySystem.TryGetSlotEntity(entity, "id", out var idUid)) return; - if (!EntityManager.TryGetComponent(idUid, out PdaComponent? pdaComponent) || !TryComp(pdaComponent.ContainedId, out var card)) + var cardId = idUid.Value; + if (TryComp(idUid, out var pdaComponent) && pdaComponent.ContainedId != null) + cardId = pdaComponent.ContainedId.Value; + + if (!TryComp(cardId, out var card)) return; - var cardId = pdaComponent.ContainedId.Value; _cardSystem.TryChangeFullName(cardId, characterName, card); _cardSystem.TryChangeJobTitle(cardId, jobPrototype.LocalizedName, card); @@ -203,7 +206,8 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem _accessSystem.SetAccessToJob(cardId, jobPrototype, extendedAccess); - _pdaSystem.SetOwner(idUid.Value, pdaComponent, characterName); + if (pdaComponent != null) + _pdaSystem.SetOwner(idUid.Value, pdaComponent, characterName); }