Skip to content

Commit

Permalink
Finally Fixing it
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus committed May 3, 2024
1 parent 5023cc4 commit 38060c9
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Content.Client.UserInterface.Systems.Language;
[UsedImplicitly]
public sealed class LanguageMenuUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>
{
[UISystemDependency] private LanguageSystem _languageSystem = default!;
[UISystemDependency] private LanguageSystem? _languageSystem = default!;
public LanguageMenuWindow? _languageWindow;
private MenuButton? LanguageButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.LanguageButton;

Expand All @@ -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<LanguageMenuWindow>();
Expand All @@ -62,6 +68,12 @@ public void OnStateExited(GameplayState state)
_languageWindow = null;
}

if (LanguagesUpdatedHook == null)
return;

if (_languageSystem == null)
return;

_languageSystem.LanguagesUpdatedHook -= LanguagesUpdatedHook;

CommandBinds.Unregister<LanguageMenuUIController>();
Expand Down

0 comments on commit 38060c9

Please sign in to comment.