From ef9f56e5850b2d76fc960b7b070a0c9b08601140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 3 Jan 2022 19:33:01 +0100 Subject: [PATCH] Fix bad check if content is placeholder The `lastContent == foundContent` check, last touched in a49a4329, is terminally broken, as it would always be false. `foundContent` is mutated when a new card load task is started in `onSearchFinished()`, which is *before* the aforementioned check. The code prior to a49a4329 was checking against the two static reused placeholder drawables which was the correct check to apply, and this commit reverts to using a variant of that check. --- osu.Game/Overlays/BeatmapListingOverlay.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/BeatmapListingOverlay.cs b/osu.Game/Overlays/BeatmapListingOverlay.cs index d9c2d90e05..ea3c08ea61 100644 --- a/osu.Game/Overlays/BeatmapListingOverlay.cs +++ b/osu.Game/Overlays/BeatmapListingOverlay.cs @@ -212,7 +212,7 @@ namespace osu.Game.Overlays // To resolve both of these issues, the bypass is delayed until a point when the content transitions (fade-in and fade-out) overlap and it looks good to do so. var sequence = lastContent.Delay(25).Schedule(() => lastContent.BypassAutoSizeAxes = Axes.Y); - if (lastContent == foundContent) + if (!isPlaceholderContent(lastContent)) { sequence.Then().Schedule(() => { @@ -232,6 +232,12 @@ namespace osu.Game.Overlays currentContent.BypassAutoSizeAxes = Axes.None; } + /// + /// Whether is a static placeholder reused multiple times by this overlay. + /// + private bool isPlaceholderContent(Drawable drawable) + => drawable == notFoundContent || drawable == supporterRequiredContent; + private void onCardSizeChanged() { if (foundContent == null || !foundContent.Any())