From a9e4a0ed50dcfbd81487afbc14ba10fd8cd7463f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 20 Apr 2021 21:17:24 +0900 Subject: [PATCH] Fix potentially starting play when finished The UserFinishedPlaying event may trigger before the event is subscribed to by SpectatorScreen. For such cases, an extra check is done to make sure the user is _actually_ playing. --- osu.Game/Screens/Spectate/SpectatorScreen.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Spectate/SpectatorScreen.cs b/osu.Game/Screens/Spectate/SpectatorScreen.cs index f554b15abf..ed01d56801 100644 --- a/osu.Game/Screens/Spectate/SpectatorScreen.cs +++ b/osu.Game/Screens/Spectate/SpectatorScreen.cs @@ -127,6 +127,10 @@ namespace osu.Game.Screens.Spectate if (!userMap.ContainsKey(userId)) return; + // The user may have stopped playing. + if (!spectatorClient.TryGetPlayingUserState(userId, out _)) + return; + Schedule(() => OnUserStateChanged(userId, state)); updateGameplayState(userId);