Merge pull request #21352 from peppy/avoid-null-audio-device-name-crahs

Avoid crashing when a system audio device provides a `null` name
This commit is contained in:
Bartłomiej Dach 2022-11-21 17:16:30 +01:00 committed by GitHub
commit d5e9cb2477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,7 +59,11 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
// the dropdown. BASS does not give us a simple mechanism to select
// specific audio devices in such a case anyways. Such
// functionality would require involved OS-specific code.
dropdown.Items = deviceItems.Distinct().ToList();
dropdown.Items = deviceItems
// Dropdown doesn't like null items. Somehow we are seeing some arrive here (see https://github.com/ppy/osu/issues/21271)
.Where(i => i != null)
.Distinct()
.ToList();
}
protected override void Dispose(bool isDisposing)