Fall back to default background

This commit is contained in:
David Zhao 2019-03-05 15:51:43 +09:00
parent 7c53c7b602
commit fc62877fdc
1 changed files with 8 additions and 3 deletions

View File

@ -30,10 +30,15 @@ protected override Drawable CreateDrawable(BeatmapInfo model)
{ {
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;