input OSD: fix potentially absent P0

I don't know if there's any core that lacks non-player controls but this feels like the right thing to do anyway (for the future too)
This commit is contained in:
feos 2024-12-22 19:07:22 +03:00
parent fcff79e794
commit 3384ce8629
1 changed files with 7 additions and 4 deletions

View File

@ -16,10 +16,13 @@ namespace BizHawk.Client.Common
throw new InvalidOperationException("Can't generate input display string with empty mnemonics cache");
var sb = new StringBuilder();
var controls = source.Definition.ControlsOrdered.ToList();
// index 0 is for controls that don't belong to any indexed player
controls.Add(controls[0]);
controls.RemoveAt(0);
var controls = source.Definition.ControlsOrdered.ToList();
// index 0 is for controls that don't belong to any indexed player
if (controls.ElementAtOrDefault(0) != null)
{
controls.Add(controls[0]);
controls.RemoveAt(0);
}
foreach ((string buttonName, AxisSpec? axisSpec) in controls.SelectMany(x => x))
{