Make more uids nullable (#5794)
This commit is contained in:
@@ -14,9 +14,6 @@ namespace Content.Client.Body.UI
|
||||
[ViewVariables]
|
||||
private BodyScannerDisplay? _display;
|
||||
|
||||
[ViewVariables]
|
||||
private EntityUid _entity;
|
||||
|
||||
public BodyScannerBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey) { }
|
||||
|
||||
protected override void Open()
|
||||
@@ -43,7 +40,7 @@ namespace Content.Client.Body.UI
|
||||
throw new ArgumentException($"Received an invalid entity with id {scannerState.Uid} for body scanner with id {Owner.Owner} at {entMan.GetComponent<TransformComponent>(Owner.Owner).MapPosition}");
|
||||
}
|
||||
|
||||
_display?.UpdateDisplay(_entity);
|
||||
_display?.UpdateDisplay(scannerState.Uid);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client.Body.UI
|
||||
{
|
||||
public sealed class BodyScannerDisplay : SS14Window
|
||||
{
|
||||
private EntityUid _currentEntity;
|
||||
private EntityUid? _currentEntity;
|
||||
private SharedBodyPartComponent? _currentBodyPart;
|
||||
|
||||
public BodyScannerDisplay(BodyScannerBoundUserInterface owner)
|
||||
@@ -104,9 +104,6 @@ namespace Content.Client.Body.UI
|
||||
|
||||
public void UpdateDisplay(EntityUid entity)
|
||||
{
|
||||
if(entity == null)
|
||||
return;
|
||||
|
||||
_currentEntity = entity;
|
||||
BodyPartList.Clear();
|
||||
|
||||
@@ -125,12 +122,7 @@ namespace Content.Client.Body.UI
|
||||
|
||||
public void BodyPartOnItemSelected(ItemListSelectedEventArgs args)
|
||||
{
|
||||
if (_currentEntity == null)
|
||||
return;
|
||||
|
||||
var body = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<SharedBodyComponent>(_currentEntity);
|
||||
|
||||
if (body == null)
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent>(_currentEntity, out var body))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user