From 38060c9b119215d85f43805daf39315220179847 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Fri, 3 May 2024 13:31:30 -0400 Subject: [PATCH] Finally Fixing it --- .../Systems/Language/LanguageMenuUIController.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Content.Client/UserInterface/Systems/Language/LanguageMenuUIController.cs b/Content.Client/UserInterface/Systems/Language/LanguageMenuUIController.cs index 887c0d66c9c..807af7463c9 100644 --- a/Content.Client/UserInterface/Systems/Language/LanguageMenuUIController.cs +++ b/Content.Client/UserInterface/Systems/Language/LanguageMenuUIController.cs @@ -21,7 +21,7 @@ namespace Content.Client.UserInterface.Systems.Language; [UsedImplicitly] public sealed class LanguageMenuUIController : UIController, IOnStateEntered, IOnStateExited { - [UISystemDependency] private LanguageSystem _languageSystem = default!; + [UISystemDependency] private LanguageSystem? _languageSystem = default!; public LanguageMenuWindow? _languageWindow; private MenuButton? LanguageButton => UIManager.GetActiveUIWidgetOrNull()?.LanguageButton; @@ -46,6 +46,12 @@ public void OnStateEntered(GameplayState state) { DebugTools.Assert(_languageWindow == null); + if (LanguagesUpdatedHook == null) + return; + + if (_languageSystem == null) + return; + _languageSystem.LanguagesUpdatedHook -= LanguagesUpdatedHook; _languageWindow = UIManager.CreateWindow(); @@ -62,6 +68,12 @@ public void OnStateExited(GameplayState state) _languageWindow = null; } + if (LanguagesUpdatedHook == null) + return; + + if (_languageSystem == null) + return; + _languageSystem.LanguagesUpdatedHook -= LanguagesUpdatedHook; CommandBinds.Unregister();