mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 17:03:02 +08:00
Change check order around to ensure re-fetches which return no results don't nullref
This commit is contained in:
parent
d4cb70735d
commit
675fe37446
@ -283,16 +283,16 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <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 virtual WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo)
|
public virtual WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo)
|
||||||
{
|
{
|
||||||
if (beatmapInfo?.BeatmapSet == null)
|
|
||||||
return DefaultBeatmap;
|
|
||||||
|
|
||||||
// if there are no files, presume the full beatmap info has not yet been fetched from the database.
|
// if there are no files, presume the full beatmap info has not yet been fetched from the database.
|
||||||
if (beatmapInfo.BeatmapSet.Files.Count == 0)
|
if (beatmapInfo?.BeatmapSet?.Files.Count == 0)
|
||||||
{
|
{
|
||||||
int lookupId = beatmapInfo.ID;
|
int lookupId = beatmapInfo.ID;
|
||||||
beatmapInfo = QueryBeatmap(b => b.ID == lookupId);
|
beatmapInfo = QueryBeatmap(b => b.ID == lookupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (beatmapInfo?.BeatmapSet == null)
|
||||||
|
return DefaultBeatmap;
|
||||||
|
|
||||||
lock (workingCache)
|
lock (workingCache)
|
||||||
{
|
{
|
||||||
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
|
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
|
||||||
|
Loading…
Reference in New Issue
Block a user