1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-19 01:17:19 +08:00

Merge pull request #695 from ColdVolcano/intro-improvements

Fix startup crash caused by MenuMusic binding
This commit is contained in:
Dean Herbert 2017-05-02 09:49:33 +09:00 committed by GitHub
commit 668566e73c

View File

@ -22,6 +22,8 @@ using osu.Game.Screens.Tournament;
using osu.Framework.Input;
using OpenTK.Input;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Screens.Menu
{
@ -74,10 +76,10 @@ namespace osu.Game.Screens.Menu
if (!menuMusic)
{
trackManager = game.Audio.Track;
int choosableBeatmapsetAmmount = beatmaps.Query<BeatmapSetInfo>().Count();
if (choosableBeatmapsetAmmount > 0)
List<BeatmapSetInfo> choosableBeatmapSets = beatmaps.Query<BeatmapSetInfo>().ToList();
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;
}
}