1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Merge pull request #12073 from peppy/fix-crash-toggle-overlay-before-loaded

Avoid potential crash if an overlay is toggled before it has been loaded
This commit is contained in:
Dan Balasescu 2021-03-19 21:38:47 +09:00 committed by GitHub
commit 5a6ff53837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -758,9 +758,15 @@ namespace osu.Game
{
otherOverlays.Where(o => o != overlay).ForEach(o => o.Hide());
// show above others if not visible at all, else leave at current depth.
if (!overlay.IsPresent)
// Partially visible so leave it at the current depth.
if (overlay.IsPresent)
return;
// Show above all other overlays.
if (overlay.IsLoaded)
overlayContent.ChangeChildDepth(overlay, (float)-Clock.CurrentTime);
else
overlay.Depth = (float)-Clock.CurrentTime;
}
private void forwardLoggedErrorsToNotifications()