mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Add assertions against null reference for connection usages
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR.Client;
|
||||
using osu.Framework.Allocation;
|
||||
@ -51,6 +52,8 @@ namespace osu.Game.Online.Spectator
|
||||
if (!IsConnected.Value)
|
||||
return Task.CompletedTask;
|
||||
|
||||
Debug.Assert(connection != null);
|
||||
|
||||
return connection.SendAsync(nameof(ISpectatorServer.BeginPlaySession), state);
|
||||
}
|
||||
|
||||
@ -59,6 +62,8 @@ namespace osu.Game.Online.Spectator
|
||||
if (!IsConnected.Value)
|
||||
return Task.CompletedTask;
|
||||
|
||||
Debug.Assert(connection != null);
|
||||
|
||||
return connection.SendAsync(nameof(ISpectatorServer.SendFrameData), data);
|
||||
}
|
||||
|
||||
@ -67,6 +72,8 @@ namespace osu.Game.Online.Spectator
|
||||
if (!IsConnected.Value)
|
||||
return Task.CompletedTask;
|
||||
|
||||
Debug.Assert(connection != null);
|
||||
|
||||
return connection.SendAsync(nameof(ISpectatorServer.EndPlaySession), state);
|
||||
}
|
||||
|
||||
@ -75,6 +82,8 @@ namespace osu.Game.Online.Spectator
|
||||
if (!IsConnected.Value)
|
||||
return Task.CompletedTask;
|
||||
|
||||
Debug.Assert(connection != null);
|
||||
|
||||
return connection.SendAsync(nameof(ISpectatorServer.StartWatchingUser), userId);
|
||||
}
|
||||
|
||||
@ -83,6 +92,8 @@ namespace osu.Game.Online.Spectator
|
||||
if (!IsConnected.Value)
|
||||
return Task.CompletedTask;
|
||||
|
||||
Debug.Assert(connection != null);
|
||||
|
||||
return connection.SendAsync(nameof(ISpectatorServer.EndWatchingUser), userId);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user