mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09: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:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user