mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 07:13:21 +08:00
Handle non-existing channels on message highlighting gracefully
This commit is contained in:
parent
c72e8a8b5e
commit
5315ff794a
@ -309,10 +309,21 @@ namespace osu.Game.Overlays
|
|||||||
/// <param name="message">The message to highlight.</param>
|
/// <param name="message">The message to highlight.</param>
|
||||||
public void HighlightMessage(Message message)
|
public void HighlightMessage(Message message)
|
||||||
{
|
{
|
||||||
if (channelManager.CurrentChannel.Value.Id != message.ChannelId)
|
Channel targetChannel;
|
||||||
channelManager.CurrentChannel.Value = channelManager.JoinedChannels.Single(c => c.Id == message.ChannelId);
|
|
||||||
|
|
||||||
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;
|
private float startDragChatHeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user