mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 17:57:29 +08:00
Fix incorrect implementation of next track choice
`SkipWhile()` in this context does not correctly ensure that `ElementAtOrDefault(1)` is not a protected track. An explicit `Where()` does. Spotted accidentally when I noticed that skipping to next track can select a protected track, but skipping to previous cannot.
This commit is contained in:
parent
a2d9302f4a
commit
2a214f7c9f
@ -351,7 +351,9 @@ namespace osu.Game.Overlays
|
|||||||
playableSet = getNextRandom(1, allowProtectedTracks);
|
playableSet = getNextRandom(1, allowProtectedTracks);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playableSet = getBeatmapSets().AsEnumerable().SkipWhile(i => !i.Equals(current?.BeatmapSetInfo) || (i.Protected && !allowProtectedTracks)).ElementAtOrDefault(1)
|
playableSet = getBeatmapSets().AsEnumerable().SkipWhile(i => !i.Equals(current?.BeatmapSetInfo))
|
||||||
|
.Where(i => !i.Protected || allowProtectedTracks)
|
||||||
|
.ElementAtOrDefault(1)
|
||||||
?? getBeatmapSets().AsEnumerable().FirstOrDefault(i => !i.Protected || allowProtectedTracks);
|
?? getBeatmapSets().AsEnumerable().FirstOrDefault(i => !i.Protected || allowProtectedTracks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user