Fix possibility of crash when selecting a random skin during skin import

This commit is contained in:
Dean Herbert 2021-01-15 16:34:28 +09:00
parent 40f020c683
commit b5e784ed42

View File

@ -91,7 +91,7 @@ namespace osu.Game.Overlays.Settings.Sections
if (skinDropdown.Items.All(s => s.ID != configBindable.Value)) if (skinDropdown.Items.All(s => s.ID != configBindable.Value))
configBindable.Value = 0; configBindable.Value = 0;
configBindable.BindValueChanged(id => dropdownBindable.Value = skinDropdown.Items.Single(s => s.ID == id.NewValue), true); configBindable.BindValueChanged(id => Scheduler.AddOnce(updateSelectedSkinFromConfig), true);
dropdownBindable.BindValueChanged(skin => dropdownBindable.BindValueChanged(skin =>
{ {
if (skin.NewValue == random_skin_info) if (skin.NewValue == random_skin_info)
@ -104,6 +104,8 @@ namespace osu.Game.Overlays.Settings.Sections
}); });
} }
private void updateSelectedSkinFromConfig() => dropdownBindable.Value = skinDropdown.Items.Single(s => s.ID == configBindable.Value);
private void updateItems() private void updateItems()
{ {
skinItems = skins.GetAllUsableSkins(); skinItems = skins.GetAllUsableSkins();