diff --git a/Content.Shared/UserInterface/ActivatableUIComponent.cs b/Content.Shared/UserInterface/ActivatableUIComponent.cs index 74e6134932..136a1f82cf 100644 --- a/Content.Shared/UserInterface/ActivatableUIComponent.cs +++ b/Content.Shared/UserInterface/ActivatableUIComponent.cs @@ -8,7 +8,7 @@ namespace Content.Shared.UserInterface public sealed partial class ActivatableUIComponent : Component { [DataField(required: true, customTypeSerializer: typeof(EnumSerializer))] - public Enum Key { get; set; } = default!; + public Enum? Key { get; set; } = default!; [ViewVariables(VVAccess.ReadWrite)] [DataField] diff --git a/Content.Shared/UserInterface/ActivatableUISystem.Power.cs b/Content.Shared/UserInterface/ActivatableUISystem.Power.cs index c904224328..64099c9573 100644 --- a/Content.Shared/UserInterface/ActivatableUISystem.Power.cs +++ b/Content.Shared/UserInterface/ActivatableUISystem.Power.cs @@ -21,7 +21,8 @@ public sealed partial class ActivatableUISystem _cell.SetPowerCellDrawEnabled(uid, false); if (HasComp(uid) && - TryComp(uid, out var activatable)) + TryComp(uid, out var activatable) && + activatable.Key != null) { _uiSystem.CloseUi(uid, activatable.Key); } @@ -54,7 +55,7 @@ public sealed partial class ActivatableUISystem /// public void CheckUsage(EntityUid uid, ActivatableUIComponent? active = null, ActivatableUIRequiresPowerCellComponent? component = null, PowerCellDrawComponent? draw = null) { - if (!Resolve(uid, ref component, ref draw, ref active, false)) + if (!Resolve(uid, ref component, ref draw, ref active, false) || active.Key == null) return; if (_cell.HasActivatableCharge(uid)) diff --git a/Content.Shared/UserInterface/ActivatableUISystem.cs b/Content.Shared/UserInterface/ActivatableUISystem.cs index 452f08c094..94271cc681 100644 --- a/Content.Shared/UserInterface/ActivatableUISystem.cs +++ b/Content.Shared/UserInterface/ActivatableUISystem.cs @@ -136,7 +136,7 @@ public sealed partial class ActivatableUISystem : EntitySystem private bool InteractUI(EntityUid user, EntityUid uiEntity, ActivatableUIComponent aui) { - if (!_uiSystem.HasUi(uiEntity, aui.Key)) + if (aui.Key == null || !_uiSystem.HasUi(uiEntity, aui.Key)) return false; if (_uiSystem.IsUiOpen(uiEntity, aui.Key, user)) @@ -205,7 +205,7 @@ public sealed partial class ActivatableUISystem : EntitySystem public void CloseAll(EntityUid uid, ActivatableUIComponent? aui = null) { - if (!Resolve(uid, ref aui, false)) + if (!Resolve(uid, ref aui, false) || aui.Key == null) return; _uiSystem.CloseUi(uid, aui.Key);