Fix metadata potentially being null

This commit is contained in:
David Zhao 2019-03-05 16:59:02 +09:00
parent 166a8c8bbb
commit 52558c5cf6
2 changed files with 4 additions and 4 deletions

View File

@ -260,12 +260,12 @@ namespace osu.Game.Beatmaps
if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo) if (beatmapInfo?.BeatmapSet == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
return DefaultBeatmap; return DefaultBeatmap;
if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
var info = beatmapInfo; var info = beatmapInfo;
beatmapInfo = QueryBeatmap(p => info.OnlineBeatmapID == p.OnlineBeatmapID) ?? beatmapInfo; beatmapInfo = QueryBeatmap(p => info.OnlineBeatmapID == p.OnlineBeatmapID) ?? beatmapInfo;
if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapInfo.BeatmapSet.Metadata;
WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(Files.Store, new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager); WorkingBeatmap working = new BeatmapManagerWorkingBeatmap(Files.Store, new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager);
previous?.TransferTo(working); previous?.TransferTo(working);

View File

@ -42,7 +42,7 @@ namespace osu.Game.Beatmaps.Drawables
else if (fallback && localBeatmap.BeatmapInfo.ID != 0) else if (fallback && localBeatmap.BeatmapInfo.ID != 0)
{ {
// Fall back to local background if one exists // Fall back to local background if one exists
drawable = new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model)); drawable = new BeatmapBackgroundSprite(localBeatmap);
} }
else else
{ {