1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Set StarDifficulty to -1 for invalid beatmaps

The StarDifficulty calculation in a BeatmapGroup would not properly deal
with Beatmaps that cannot be loaded and thus cause a
NullReferenceException when trying to work with them, instead of
assigning a StarDifficulty of -1 to signify that the map is invalid.
This commit is contained in:
default0 2017-02-26 21:34:27 +01:00
parent 8d91519d59
commit 0d1dec665a
2 changed files with 2 additions and 2 deletions

@ -1 +1 @@
Subproject commit 5e038727036aec5cb0005a4eab30fd73fa5ceb18
Subproject commit 92db4fc015274a4b8a74d9adb2d7a68b8be2134c

View File

@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Drawables
BeatmapSet = beatmapSet;
WorkingBeatmap beatmap = database.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault());
foreach (var b in BeatmapSet.Beatmaps)
b.StarDifficulty = (float)database.GetWorkingBeatmap(b).Beatmap.CalculateStarDifficulty();
b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? -1f);
Header = new BeatmapSetHeader(beatmap)
{