diff --git a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs
index 44c893363b..6b08745dd7 100644
--- a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs
+++ b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs
@@ -184,7 +184,7 @@ namespace osu.Game.Screens.Multi.Lounge
///
/// Push a room as a new subscreen.
///
- public void Open(Room room)
+ public virtual void Open(Room room)
{
// Handles the case where a room is clicked 3 times in quick succession
if (!this.IsCurrentScreen())
diff --git a/osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeLoungeSubScreen.cs b/osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeLoungeSubScreen.cs
index 9fbf0c4654..b53ec94519 100644
--- a/osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeLoungeSubScreen.cs
+++ b/osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeLoungeSubScreen.cs
@@ -1,7 +1,10 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using osu.Framework.Allocation;
+using osu.Framework.Logging;
using osu.Game.Online.Multiplayer;
+using osu.Game.Online.RealtimeMultiplayer;
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components;
using osu.Game.Screens.Multi.Match;
@@ -13,5 +16,19 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
protected override FilterControl CreateFilterControl() => new RealtimeFilterControl();
protected override RoomSubScreen CreateRoomSubScreen(Room room) => new RealtimeMatchSubScreen(room);
+
+ [Resolved]
+ private StatefulMultiplayerClient client { get; set; }
+
+ public override void Open(Room room)
+ {
+ if (!client.IsConnected.Value)
+ {
+ Logger.Log("Not currently connected to the multiplayer server.", LoggingTarget.Runtime, LogLevel.Important);
+ return;
+ }
+
+ base.Open(room);
+ }
}
}
diff --git a/osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeRoomManager.cs b/osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeRoomManager.cs
index f982574eb3..2f60f504de 100644
--- a/osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeRoomManager.cs
+++ b/osu.Game/Screens/Multi/RealtimeMultiplayer/RealtimeRoomManager.cs
@@ -43,6 +43,12 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
public override void JoinRoom(Room room, Action onSuccess = null, Action onError = null)
{
+ if (!multiplayerClient.IsConnected.Value)
+ {
+ onError?.Invoke("Not currently connected to the multiplayer server.");
+ return;
+ }
+
// this is done here as a pre-check to avoid clicking on already closed rooms in the lounge from triggering a server join.
// should probably be done at a higher level, but due to the current structure of things this is the easiest place for now.
if (room.Status.Value is RoomStatusEnded)