From 1262e76a584c4b1e748f9309ad1efcfaf6e8ee55 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Dec 2021 23:18:03 +0900 Subject: [PATCH] Fix test failure due to missing DI cached `IdleTracker` --- osu.Game/Online/Chat/ChannelManager.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 4889ad0a3b..e9e145e2ab 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -68,20 +68,21 @@ namespace osu.Game.Online.Chat public readonly BindableBool HighPollRate = new BindableBool(); - private IBindable isIdle; + private readonly IBindable isIdle = new BindableBool(); public ChannelManager() { CurrentChannel.ValueChanged += currentChannelChanged; } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(permitNulls: true)] private void load(IdleTracker idleTracker) { HighPollRate.BindValueChanged(updatePollRate); - - isIdle = idleTracker.IsIdle.GetBoundCopy(); isIdle.BindValueChanged(updatePollRate, true); + + if (idleTracker != null) + isIdle.BindTo(idleTracker.IsIdle); } private void updatePollRate(ValueChangedEvent valueChangedEvent)