1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 07:42:55 +08:00

Check against the loaded drawable channel

This commit is contained in:
Jai Sharma 2022-05-18 20:00:42 +01:00
parent bd68ffa805
commit 371738b047

View File

@ -263,18 +263,18 @@ namespace osu.Game.Overlays
ChatOverlayDrawableChannel drawableChannel = new ChatOverlayDrawableChannel(newChannel); ChatOverlayDrawableChannel drawableChannel = new ChatOverlayDrawableChannel(newChannel);
loadedChannels.Add(newChannel, drawableChannel); loadedChannels.Add(newChannel, drawableChannel);
LoadComponentAsync(drawableChannel, loaded => LoadComponentAsync(drawableChannel, loadedDrawable =>
{ {
// Ensure the current channel hasn't changed by the time the load completes // Ensure the current channel hasn't changed by the time the load completes
if (currentChannel.Value != newChannel) if (currentChannel.Value != loadedDrawable.Channel)
return; return;
// Ensure the cached reference hasn't been removed from leaving the channel // Ensure the cached reference hasn't been removed from leaving the channel
if (!loadedChannels.ContainsKey(newChannel)) if (!loadedChannels.ContainsKey(loadedDrawable.Channel))
return; return;
currentChannelContainer.Clear(false); currentChannelContainer.Clear(false);
currentChannelContainer.Add(loaded); currentChannelContainer.Add(loadedDrawable);
loading.Hide(); loading.Hide();
}); });
} }