Fix `stack` nullability

This commit is contained in:
Dean Herbert 2022-04-19 13:48:43 +09:00
parent a8d32a2061
commit 5dc3805005
1 changed files with 7 additions and 5 deletions

View File

@ -39,7 +39,7 @@ public class FirstRunSetupOverlay : OsuFocusedOverlayContainer
[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 @@ public class FirstRunSetupOverlay : OsuFocusedOverlayContainer
/// <summary>
/// The currently displayed screen, if any.
/// </summary>
public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack.CurrentScreen;
public FirstRunSetupScreen? CurrentScreen => (FirstRunSetupScreen?)stack?.CurrentScreen;
private readonly FirstRunStep[] steps =
{
@ -217,6 +217,7 @@ protected override void LoadComplete()
private void showLastStep()
{
Debug.Assert(currentStepIndex > 0);
Debug.Assert(stack != null);
stack.CurrentScreen.Exit();
currentStepIndex--;
@ -241,6 +242,8 @@ private void showNextStep()
currentStepIndex++;
Debug.Assert(currentStepIndex != null);
Debug.Assert(stack != null);
BackButton.Enabled.Value = currentStepIndex > 0;
if (currentStepIndex < steps.Length)
@ -294,9 +297,8 @@ protected override void PopOut()
}
else
{
stack?
.FadeOut(100)
.Expire();
stack?.FadeOut(100)
.Expire();
}
base.PopOut();