From 5dc38050056e4bb524e48af24bb385c65c5c276b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Apr 2022 13:48:43 +0900 Subject: [PATCH] Fix `stack` nullability --- osu.Game/Overlays/FirstRunSetupOverlay.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/FirstRunSetupOverlay.cs b/osu.Game/Overlays/FirstRunSetupOverlay.cs index ee78865618..27ff4aaabf 100644 --- a/osu.Game/Overlays/FirstRunSetupOverlay.cs +++ b/osu.Game/Overlays/FirstRunSetupOverlay.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays [Resolved] private INotificationOverlay notificationOverlay { get; set; } = null!; - private ScreenStack stack = null!; + private ScreenStack? stack; public PurpleTriangleButton NextButton = null!; public DangerousTriangleButton BackButton = null!; @@ -54,7 +54,7 @@ namespace osu.Game.Overlays /// /// The currently displayed screen, if any. /// - public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack.CurrentScreen; + public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack?.CurrentScreen; private readonly FirstRunStep[] steps = { @@ -217,6 +217,7 @@ namespace osu.Game.Overlays private void showLastStep() { Debug.Assert(currentStepIndex > 0); + Debug.Assert(stack != null); stack.CurrentScreen.Exit(); currentStepIndex--; @@ -241,6 +242,8 @@ namespace osu.Game.Overlays currentStepIndex++; Debug.Assert(currentStepIndex != null); + Debug.Assert(stack != null); + BackButton.Enabled.Value = currentStepIndex > 0; if (currentStepIndex < steps.Length) @@ -294,9 +297,8 @@ namespace osu.Game.Overlays } else { - stack? - .FadeOut(100) - .Expire(); + stack?.FadeOut(100) + .Expire(); } base.PopOut();