mirror of
https://github.com/ppy/osu
synced 2024-12-25 16:22:23 +00:00
Fix exception when adding duplicate items
This commit is contained in:
parent
f0f739707f
commit
f31220c1ee
@ -126,6 +126,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddAssert("playlist has 1 item", () => Room.Playlist.Count == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddSameItemMultipleTimes()
|
||||
{
|
||||
AddStep("create new item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||
AddStep("create new item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||
AddAssert("playlist has 2 items", () => Room.Playlist.Count == 2);
|
||||
}
|
||||
|
||||
private class TestMatchSongSelect : MatchSongSelect
|
||||
{
|
||||
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Humanizer;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -53,6 +54,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
PlaylistItem item = new PlaylistItem
|
||||
{
|
||||
ID = (Playlist.LastOrDefault()?.ID + 1) ?? 0,
|
||||
Beatmap = { Value = Beatmap.Value.BeatmapInfo },
|
||||
Ruleset = { Value = Ruleset.Value }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user