1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +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);
loadedChannels.Add(newChannel, drawableChannel);
LoadComponentAsync(drawableChannel, loaded =>
LoadComponentAsync(drawableChannel, loadedDrawable =>
{
// Ensure the current channel hasn't changed by the time the load completes
if (currentChannel.Value != newChannel)
if (currentChannel.Value != loadedDrawable.Channel)
return;
// Ensure the cached reference hasn't been removed from leaving the channel
if (!loadedChannels.ContainsKey(newChannel))
if (!loadedChannels.ContainsKey(loadedDrawable.Channel))
return;
currentChannelContainer.Clear(false);
currentChannelContainer.Add(loaded);
currentChannelContainer.Add(loadedDrawable);
loading.Hide();
});
}