1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:02:55 +08:00

Allow null parameter to GetWorkingBeatmap for now

This commit is contained in:
Dean Herbert 2022-06-30 16:46:28 +09:00
parent 98938821e5
commit 82134ad1a6

View File

@ -436,20 +436,23 @@ namespace osu.Game.Beatmaps
/// <param name="beatmapInfo">The beatmap to lookup.</param> /// <param name="beatmapInfo">The beatmap to lookup.</param>
/// <param name="refetch">Whether to force a refetch from the database to ensure <see cref="BeatmapInfo"/> is up-to-date.</param> /// <param name="refetch">Whether to force a refetch from the database to ensure <see cref="BeatmapInfo"/> is up-to-date.</param>
/// <returns>A <see cref="WorkingBeatmap"/> instance correlating to the provided <see cref="BeatmapInfo"/>.</returns> /// <returns>A <see cref="WorkingBeatmap"/> instance correlating to the provided <see cref="BeatmapInfo"/>.</returns>
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, bool refetch = false) public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo? beatmapInfo, bool refetch = false)
{ {
// Detached sets don't come with files. if (beatmapInfo != null)
// If we seem to be missing files, now is a good time to re-fetch.
if (refetch || beatmapInfo.IsManaged || beatmapInfo.BeatmapSet?.Files.Count == 0)
{ {
workingBeatmapCache.Invalidate(beatmapInfo); // Detached sets don't come with files.
// If we seem to be missing files, now is a good time to re-fetch.
if (refetch || beatmapInfo.IsManaged || beatmapInfo.BeatmapSet?.Files.Count == 0)
{
workingBeatmapCache.Invalidate(beatmapInfo);
Guid id = beatmapInfo.ID; Guid id = beatmapInfo.ID;
beatmapInfo = Realm.Run(r => r.Find<BeatmapInfo>(id)?.Detach()) ?? beatmapInfo; beatmapInfo = Realm.Run(r => r.Find<BeatmapInfo>(id)?.Detach()) ?? beatmapInfo;
}
Debug.Assert(beatmapInfo.IsManaged != true);
} }
Debug.Assert(beatmapInfo.IsManaged != true);
return workingBeatmapCache.GetWorkingBeatmap(beatmapInfo); return workingBeatmapCache.GetWorkingBeatmap(beatmapInfo);
} }