From 33a87976a8ac17f8ac0d559b254c6c4a0862c35e Mon Sep 17 00:00:00 2001 From: Susko3 <16479013+Susko3@users.noreply.github.com> Date: Thu, 24 Feb 2022 21:11:49 +0100 Subject: [PATCH] Rewrite to read better Co-authored-by: Dean Herbert --- osu.Game/Screens/Menu/MainMenu.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 0357332cf6..b0208a0ae8 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -306,10 +307,13 @@ namespace osu.Game.Screens.Menu if (e.Repeat) return false; - if (e.Action == GlobalAction.Back && host.CanSuspendToBackground) + switch (e.Action) { - if (host.SuspendToBackground()) - return true; + case GlobalAction.Back: + // In the case of a host being able to exit, the back action is handled by ExitConfirmOverlay. + Debug.Assert(!host.CanExit); + + return host.SuspendToBackground(); } return false;