From b3403c78da4071051cfad7c64ed77b5d11fa637d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 25 Jan 2019 20:47:37 +0900 Subject: [PATCH] Fix a few potential crashes --- osu.Game/Screens/Multi/Match/MatchSubScreen.cs | 6 +++++- osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index 19b33f70d3..accddc3ba6 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -120,7 +120,11 @@ namespace osu.Game.Screens.Multi.Match } }; - chat.Exit += this.Exit; + chat.Exit += () => + { + if (this.IsCurrentScreen()) + this.Exit(); + }; } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index ac5aec2196..d3c7bd849f 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play { protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); - protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background; + protected new BackgroundScreenBeatmap Background => base.Background as BackgroundScreenBeatmap; public override bool AllowBeatmapRulesetChange => false;