From 09f9f86b062e9420767480164602e041e97e9dca Mon Sep 17 00:00:00 2001 From: n4b3l Date: Mon, 19 Dec 2016 14:03:10 +0100 Subject: [PATCH 1/2] check if dimLevel is null on exit --- osu.Game/Screens/Play/Player.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7b6f260c56..236a84ccfd 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -158,7 +158,8 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(GameMode next) { - dimLevel.ValueChanged -= dimChanged; + if(dimLevel != null) + dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); } From aebe87fefc9fec87d350907d0dd040cdfa4834e3 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Mon, 19 Dec 2016 16:09:29 +0100 Subject: [PATCH 2/2] better implementation --- osu.Game/Screens/Play/Player.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 236a84ccfd..ca4245504b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -50,6 +50,7 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) { + dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); try { if (Beatmap == null) @@ -114,7 +115,6 @@ namespace osu.Game.Screens.Play }, scoreOverlay, }; - dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); } protected override void LoadComplete() @@ -158,8 +158,7 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(GameMode next) { - if(dimLevel != null) - dimLevel.ValueChanged -= dimChanged; + dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); }