From c1e9b6d4cae0793de9bc15cc055808db4995b1a3 Mon Sep 17 00:00:00 2001
From: Dean Herbert <pe@ppy.sh>
Date: Fri, 3 May 2024 13:42:56 +0800
Subject: [PATCH 1/2] Fix beatmap backgrounds loading default briefly before
 final display

Due to the way `ModelBackedDrawable` works, the default starts to get
loaded even though a final `Beatmap` has been set. This avoids loading
the default fallback unless a beatmap has been set (and has no
background itself).
---
 .../Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
index 0bb60847e5..f067af5360 100644
--- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
+++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
@@ -52,6 +52,9 @@ namespace osu.Game.Beatmaps.Drawables
 
         private Drawable getDrawableForModel(IBeatmapInfo? model)
         {
+            if (model == null)
+                return Empty();
+
             // prefer online cover where available.
             if (model?.BeatmapSet is IBeatmapSetOnlineInfo online)
                 return new OnlineBeatmapSetCover(online, beatmapSetCoverType);

From d1a50ff85bbfb4a502bd4df25a53d93386d7f920 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= <dach.bartlomiej@gmail.com>
Date: Fri, 3 May 2024 08:11:00 +0200
Subject: [PATCH 2/2] Remove redundant conditional access

---
 .../Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
index f067af5360..6f71fa90b8 100644
--- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
+++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs
@@ -56,7 +56,7 @@ namespace osu.Game.Beatmaps.Drawables
                 return Empty();
 
             // prefer online cover where available.
-            if (model?.BeatmapSet is IBeatmapSetOnlineInfo online)
+            if (model.BeatmapSet is IBeatmapSetOnlineInfo online)
                 return new OnlineBeatmapSetCover(online, beatmapSetCoverType);
 
             if (model is BeatmapInfo localModel)