1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 17:53:15 +08:00

Add null checks/allowances

This commit is contained in:
Dean Herbert 2019-01-31 11:00:33 +09:00
parent d34aa50613
commit beab367e6d

View File

@ -64,10 +64,10 @@ namespace osu.Game.Screens
private BackgroundScreen localBackground; private BackgroundScreen localBackground;
[Resolved] [Resolved(canBeNull: true)]
private BackgroundScreenStack backgroundStack { get; set; } private BackgroundScreenStack backgroundStack { get; set; }
[Resolved] [Resolved(canBeNull: true)]
private OsuLogo logo { get; set; } private OsuLogo logo { get; set; }
protected OsuScreen() protected OsuScreen()
@ -124,7 +124,7 @@ namespace osu.Game.Screens
{ {
applyArrivingDefaults(false); applyArrivingDefaults(false);
backgroundStack.Push(localBackground = CreateBackground()); backgroundStack?.Push(localBackground = CreateBackground());
base.OnEntering(last); base.OnEntering(last);
} }
@ -137,7 +137,7 @@ namespace osu.Game.Screens
if (base.OnExiting(next)) if (base.OnExiting(next))
return true; return true;
backgroundStack.Exit(localBackground); backgroundStack?.Exit(localBackground);
Beatmap.UnbindAll(); Beatmap.UnbindAll();
return false; return false;
@ -153,12 +153,13 @@ namespace osu.Game.Screens
private void applyArrivingDefaults(bool isResuming) private void applyArrivingDefaults(bool isResuming)
{ {
logo.AppendAnimatingAction(() => logo?.AppendAnimatingAction(() =>
{ {
if (this.IsCurrentScreen()) LogoArriving(logo, isResuming); if (this.IsCurrentScreen()) LogoArriving(logo, isResuming);
}, true); }, true);
backgroundStack.ParallaxAmount = BackgroundParallaxAmount; if (backgroundStack != null)
backgroundStack.ParallaxAmount = BackgroundParallaxAmount;
} }
/// <summary> /// <summary>
@ -180,7 +181,7 @@ namespace osu.Game.Screens
private void onExitingLogo() private void onExitingLogo()
{ {
logo.AppendAnimatingAction(() => LogoExiting(logo), false); logo?.AppendAnimatingAction(() => LogoExiting(logo), false);
} }
/// <summary> /// <summary>
@ -192,7 +193,7 @@ namespace osu.Game.Screens
private void onSuspendingLogo() private void onSuspendingLogo()
{ {
logo.AppendAnimatingAction(() => LogoSuspending(logo), false); logo?.AppendAnimatingAction(() => LogoSuspending(logo), false);
} }
/// <summary> /// <summary>