Skip to content

Commit fa029a7

Browse files
AppUI: Handle weird MIDI device setting inheritance
If for unknown reasons it is not possible to retrieve the current one set, fallback to the first one in the list
1 parent f9aaaa4 commit fa029a7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

AppUI/ViewModels/GameLaunchSettingsViewModel.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -609,17 +609,16 @@ private void SetSelectedSoundDeviceFromSettings(LaunchSettings launchSettings)
609609

610610
private void SetSelectedMidiDeviceFromSettings()
611611
{
612-
int MidiDevIDFromReg = GetMidiDeviceInRegistry();
613-
614-
if (MidiDevIDFromReg < MidiDevices.Count - 1)
612+
try
615613
{
616-
SelectedMidiDevice = MidiDevices.ElementAt(0);
614+
int MidiDevIDFromReg = GetMidiDeviceInRegistry();
615+
SelectedMidiDevice = MidiDevices.ElementAt(MidiDevIDFromReg);
617616
}
618-
else
617+
catch
619618
{
620-
SelectedMidiDevice = MidiDevices.ElementAt(MidiDevIDFromReg);
619+
// Always default to first element if picking the current set one fails for some reason
620+
SelectedMidiDevice = MidiDevices.ElementAt(0);
621621
}
622-
623622
}
624623

625624
internal bool SaveSettings()

0 commit comments

Comments
 (0)