1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 17:13:06 +08:00

Fall back to default background

This commit is contained in:
David Zhao 2019-03-05 15:51:43 +09:00
parent 7c53c7b602
commit fc62877fdc

View File

@ -30,10 +30,15 @@ namespace osu.Game.Beatmaps.Drawables
{ {
return new DelayedLoadUnloadWrapper(() => return new DelayedLoadUnloadWrapper(() =>
{ {
if (model?.BeatmapSet?.OnlineInfo == null) Drawable drawable;
return null;
Drawable drawable = new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType); if (model?.BeatmapSet?.OnlineInfo != null)
drawable = new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
else
{
// Use the default background if somehow an online set does not exist.
drawable = new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(null));
}
drawable.RelativeSizeAxes = Axes.Both; drawable.RelativeSizeAxes = Axes.Both;
drawable.Anchor = Anchor.Centre; drawable.Anchor = Anchor.Centre;