mirror of
https://github.com/ppy/osu.git
synced 2026-06-03 15:04:26 +08:00
Merge pull request #35241 from bdach/song-select-crash-on-missing-group
Fix carousel sometimes crashing when attempting to select next random set
This commit is contained in:
@@ -1012,13 +1012,13 @@ namespace osu.Game.Screens.SelectV2
|
||||
|
||||
private bool nextRandomSet()
|
||||
{
|
||||
ICollection<GroupedBeatmapSet> visibleGroupedSets = ExpandedGroup != null
|
||||
ICollection<GroupedBeatmapSet> visibleGroupedSets = ExpandedGroup != null && grouping.GroupItems.TryGetValue(ExpandedGroup, out var groupItems)
|
||||
// In the case of grouping, users expect random to only operate on the expanded group.
|
||||
// This is going to incur some overhead as we don't have a group-beatmapset mapping currently.
|
||||
//
|
||||
// If this becomes an issue, we could either store a mapping, or run the random algorithm many times
|
||||
// using the `SetItems` method until we get a group HIT.
|
||||
? grouping.GroupItems[ExpandedGroup].Select(i => i.Model).OfType<GroupedBeatmapSet>().ToArray()
|
||||
? groupItems.Select(i => i.Model).OfType<GroupedBeatmapSet>().ToArray()
|
||||
// This is the fastest way to retrieve sets for randomisation.
|
||||
: grouping.SetItems.Keys;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user