Fix crash on load when no slot key assigned (#26354)

Co-authored-by: wrexbe <wrexbe@protonmail.com>
This commit is contained in:
Wrexbe (Josh)
2024-03-22 20:55:19 -07:00
committed by GitHub
parent 6e8a07844a
commit e69723153d

View File

@@ -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();
}