Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ public void TestDelayedRoomScreenPushDoesNotRunIfRoomIsLeftPrematurely()
AddWaitStep("wait a little bit", 10);
}

[Test]
public void TestRoomScreenPushNullHandling()
{
AddStep("leave room", () => MultiplayerClient.LeaveRoom());

AddWaitStep("wait for room leave", 5);

AddStep("change state to in room", () => queueScreen!.SetState(ScreenQueue.MatchmakingScreenState.InRoom));

AddWaitStep("wait a little bit", 10);
}

private static double generateCount(double x, double mean, double stdDev, double amplitude)
{
return amplitude * Math.Exp(-Math.Pow(x - mean, 2) / (2 * Math.Pow(stdDev, 2))) + Random.Shared.Next(300);
Expand Down
12 changes: 10 additions & 2 deletions osu.Game/Screens/OnlinePlay/Matchmaking/Queue/ScreenQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Framework.Threading;
using osu.Game.Database;
Expand Down Expand Up @@ -728,14 +729,21 @@ public void SetState(MatchmakingScreenState newState)
{
pushScreenDelegate = Schedule(() =>
{
if (client.Room == null)
{
Logger.Log("Room became null, returning to idle");
SetState(MatchmakingScreenState.Idle);
return;
}

switch (poolType)
{
case MatchmakingPoolType.QuickPlay:
this.Push(new ScreenMatchmaking(client.Room!));
this.Push(new ScreenMatchmaking(client.Room));
break;

case MatchmakingPoolType.RankedPlay:
this.Push(new RankedPlayScreen(client.Room!));
this.Push(new RankedPlayScreen(client.Room));
break;
}
});
Expand Down
Loading