From e69723153dc571e1461c99ac5c7d82a1992e011d Mon Sep 17 00:00:00 2001 From: "Wrexbe (Josh)" <81056464+wrexbe@users.noreply.github.com> Date: Fri, 22 Mar 2024 20:55:19 -0700 Subject: [PATCH] Fix crash on load when no slot key assigned (#26354) Co-authored-by: wrexbe --- .../Systems/Actions/Controls/ActionButtonContainer.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Content.Client/UserInterface/Systems/Actions/Controls/ActionButtonContainer.cs b/Content.Client/UserInterface/Systems/Actions/Controls/ActionButtonContainer.cs index a2aa972625..c5f8adbdea 100644 --- a/Content.Client/UserInterface/Systems/Actions/Controls/ActionButtonContainer.cs +++ b/Content.Client/UserInterface/Systems/Actions/Controls/ActionButtonContainer.cs @@ -42,11 +42,12 @@ public class ActionButtonContainer : GridContainer { var button = new ActionButton(_entity); - if (keys.TryGetValue(index, out var boundKey)) - { - button.KeyBind = boundKey; + if (!keys.TryGetValue(index, out var boundKey)) + return button; - var binding = _input.GetKeyBinding(boundKey); + button.KeyBind = boundKey; + if (_input.TryGetKeyBinding(boundKey, out var binding)) + { button.Label.Text = binding.GetKeyString(); } -- 2.51.2