Make more uids nullable (#5794)
This commit is contained in:
@@ -37,9 +37,9 @@ namespace Content.Server.Storage.Components
|
||||
if (lockers.Contains(Owner))
|
||||
lockers.Remove(Owner);
|
||||
|
||||
var lockerEnt = _robustRandom.Pick(lockers);
|
||||
if (lockers.Count == 0) return;
|
||||
|
||||
if (lockerEnt == null) return; // No valid lockers anywhere.
|
||||
var lockerEnt = _robustRandom.Pick(lockers);
|
||||
|
||||
var locker = _entMan.GetComponent<EntityStorageComponent>(lockerEnt);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Server.Storage.EntitySystems
|
||||
return;
|
||||
|
||||
var alreadySpawnedGroups = new List<string>();
|
||||
EntityUid entityToPlaceInHands = default;
|
||||
EntityUid? entityToPlaceInHands = null;
|
||||
foreach (var storageItem in component.Items)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(storageItem.GroupId) &&
|
||||
@@ -57,10 +57,10 @@ namespace Content.Server.Storage.EntitySystems
|
||||
EntityManager.DeleteEntity(uid);
|
||||
}
|
||||
|
||||
if (entityToPlaceInHands != default
|
||||
if (entityToPlaceInHands != null
|
||||
&& EntityManager.TryGetComponent<SharedHandsComponent?>(args.User, out var hands))
|
||||
{
|
||||
hands.TryPutInAnyHand(entityToPlaceInHands);
|
||||
hands.TryPutInAnyHand(entityToPlaceInHands.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user