Merge pull request #2934 from smoogipoo/fix-skin-crash

Fix crash if the skin stored in the config doesn't exist anymore
This commit is contained in:
Dean Herbert 2018-07-02 17:07:47 +09:00 committed by GitHub
commit 7c5ad43d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,13 @@ namespace osu.Game.Overlays.Settings.Sections
reloadSkins();
skinDropdown.Bindable = config.GetBindable<int>(OsuSetting.Skin);
var skinBindable = config.GetBindable<int>(OsuSetting.Skin);
// Todo: This should not be necessary when OsuConfigManager is databased
if (skinDropdown.Items.All(s => s.Value != skinBindable.Value))
skinBindable.Value = 0;
skinDropdown.Bindable = skinBindable;
}
private void reloadSkins() => skinDropdown.Items = skins.GetAllUsableSkins().Select(s => new KeyValuePair<string, int>(s.ToString(), s.ID));