mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:52:54 +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:
commit
5a6ff53837
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user