From 09d7dc73dc043240e33c4136bafd55353fa9420e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 22 Dec 2018 14:38:46 +0900 Subject: [PATCH] Allow channel manager and osugame to be null --- osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs | 4 ++-- osu.Game/Screens/Multi/Match/MatchScreen.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs b/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs index ecb7b86fb4..0d7221754f 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs @@ -11,7 +11,7 @@ namespace osu.Game.Screens.Multi.Match.Components { private readonly Room room; - [Resolved] + [Resolved(CanBeNull = true)] private ChannelManager channelManager { get; set; } public MatchChatDisplay(Room room) @@ -30,7 +30,7 @@ namespace osu.Game.Screens.Multi.Match.Components private void updateChannel() { if (room.RoomID.Value != null) - Channel.Value = channelManager.JoinChannel(new Channel { Id = room.ChannelId, Type = ChannelType.Multiplayer, Name = $"#mp_{room.RoomID}" }); + Channel.Value = channelManager?.JoinChannel(new Channel { Id = room.ChannelId, Type = ChannelType.Multiplayer, Name = $"#mp_{room.RoomID}" }); } } } diff --git a/osu.Game/Screens/Multi/Match/MatchScreen.cs b/osu.Game/Screens/Multi/Match/MatchScreen.cs index 9a5950417b..72803c20a0 100644 --- a/osu.Game/Screens/Multi/Match/MatchScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchScreen.cs @@ -36,7 +36,7 @@ namespace osu.Game.Screens.Multi.Match [Resolved] private BeatmapManager beatmapManager { get; set; } - [Resolved] + [Resolved(CanBeNull = true)] private OsuGame game { get; set; } [Resolved(CanBeNull = true)] @@ -120,7 +120,7 @@ namespace osu.Game.Screens.Multi.Match // Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID); - game.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap)); + game?.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap)); } private void setMods(IEnumerable mods) @@ -133,7 +133,7 @@ namespace osu.Game.Screens.Multi.Match if (ruleset == null) return; - game.ForcefullySetRuleset(ruleset); + game?.ForcefullySetRuleset(ruleset); } private void addPlaylistItem(PlaylistItem item)