diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index d6a1b23c46..a0b5e55014 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -309,10 +309,21 @@ namespace osu.Game.Overlays /// The message to highlight. public void HighlightMessage(Message message) { - if (channelManager.CurrentChannel.Value.Id != message.ChannelId) - channelManager.CurrentChannel.Value = channelManager.JoinedChannels.Single(c => c.Id == message.ChannelId); + Channel targetChannel; - channelManager.CurrentChannel.Value.HighlightedMessage.Value = message; + if (channelManager.CurrentChannel.Value.Id == message.ChannelId) + targetChannel = channelManager.CurrentChannel.Value; + else + { + targetChannel = channelManager.JoinedChannels.SingleOrDefault(c => c.Id == message.ChannelId); + + if (targetChannel != null) + channelManager.CurrentChannel.Value = targetChannel; + else + targetChannel = channelManager.JoinChannel(channelManager.AvailableChannels.SingleOrDefault(c => c.Id == message.ChannelId), true); + } + + targetChannel.HighlightedMessage.Value = message; } private float startDragChatHeight;