1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 16:27:26 +08:00

Merge pull request #11681 from peppy/fix-crash-on-incompatible-freemod-selection

Fix crashes when setting a mod in free mod select overlay which requires deselection of another mod
This commit is contained in:
Dan Balasescu 2021-02-05 17:55:16 +09:00 committed by GitHub
commit 3997cd4104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 6 deletions

View File

@ -333,7 +333,7 @@ namespace osu.Game.Tests.Visual.UserInterface
};
}
private class TestModSelectOverlay : SoloModSelectOverlay
private class TestModSelectOverlay : LocalPlayerModSelectOverlay
{
public new Bindable<IReadOnlyList<Mod>> SelectedMods => base.SelectedMods;

View File

@ -151,7 +151,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddUntilStep("wait for ready", () => modSelect.State.Value == Visibility.Visible && modSelect.ButtonsLoaded);
}
private class TestModSelectOverlay : SoloModSelectOverlay
private class TestModSelectOverlay : LocalPlayerModSelectOverlay
{
public new VisibilityContainer ModSettingsContainer => base.ModSettingsContainer;
public new TriangleButton CustomiseButton => base.CustomiseButton;

View File

@ -469,6 +469,10 @@ namespace osu.Game
{
updateModDefaults();
// a lease may be taken on the mods bindable, at which point we can't really ensure valid mods.
if (SelectedMods.Disabled)
return;
if (!ModUtils.CheckValidForGameplay(mods.NewValue, out var invalid))
{
// ensure we always have a valid set of mods.

View File

@ -5,7 +5,7 @@ using osu.Game.Rulesets.Mods;
namespace osu.Game.Overlays.Mods
{
public class SoloModSelectOverlay : ModSelectOverlay
public class LocalPlayerModSelectOverlay : ModSelectOverlay
{
protected override void OnModSelected(Mod mod)
{

View File

@ -373,7 +373,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
client.LoadRequested -= onLoadRequested;
}
private class UserModSelectOverlay : ModSelectOverlay
private class UserModSelectOverlay : LocalPlayerModSelectOverlay
{
public UserModSelectOverlay()
{

View File

@ -125,7 +125,7 @@ namespace osu.Game.Screens.OnlinePlay
return base.OnExiting(next);
}
protected override ModSelectOverlay CreateModSelectOverlay() => new SoloModSelectOverlay
protected override ModSelectOverlay CreateModSelectOverlay() => new LocalPlayerModSelectOverlay
{
IsValidMod = IsValidMod
};

View File

@ -311,7 +311,7 @@ namespace osu.Game.Screens.Select
(new FooterButtonOptions(), BeatmapOptions)
};
protected virtual ModSelectOverlay CreateModSelectOverlay() => new SoloModSelectOverlay();
protected virtual ModSelectOverlay CreateModSelectOverlay() => new LocalPlayerModSelectOverlay();
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
{