mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Fix crash when selecting non-existent IDs from database
This commit is contained in:
parent
b52781db73
commit
1b52445f86
@ -22,6 +22,8 @@ using osu.Game.Screens.Tournament;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
@ -74,10 +76,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (!menuMusic)
|
if (!menuMusic)
|
||||||
{
|
{
|
||||||
trackManager = game.Audio.Track;
|
trackManager = game.Audio.Track;
|
||||||
int choosableBeatmapsetAmmount = beatmaps.Query<BeatmapSetInfo>().Count();
|
List<BeatmapSetInfo> choosableBeatmapsets = beatmaps.Query<BeatmapSetInfo>().ToList();
|
||||||
if (choosableBeatmapsetAmmount > 0)
|
if (choosableBeatmapsets.Count > 0)
|
||||||
{
|
{
|
||||||
song = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren<BeatmapSetInfo>(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]);
|
song = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren<BeatmapSetInfo>(choosableBeatmapsets[RNG.Next(0, choosableBeatmapsets.Count - 1)].ID).Beatmaps[0]);
|
||||||
Beatmap = song;
|
Beatmap = song;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user