aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Session/WebSocketController.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-11-13 11:24:46 -0700
committercrobibero <cody@robibe.ro>2020-11-13 11:24:46 -0700
commit95ebb9a55ace6c544fa7fa15d0a255a5cee752a8 (patch)
treef5ce2c6ea994d63712d45772ad712ac6bcf79ab6 /Emby.Server.Implementations/Session/WebSocketController.cs
parent5f52a58e785fa4ae06fa07a93b81c1e7547ac9f3 (diff)
Use null coalescing when possible
Diffstat (limited to 'Emby.Server.Implementations/Session/WebSocketController.cs')
-rw-r--r--Emby.Server.Implementations/Session/WebSocketController.cs7
1 files changed, 1 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
index 78f83e337..5268ea1b9 100644
--- a/Emby.Server.Implementations/Session/WebSocketController.cs
+++ b/Emby.Server.Implementations/Session/WebSocketController.cs
@@ -58,12 +58,7 @@ namespace Emby.Server.Implementations.Session
private void OnConnectionClosed(object? sender, EventArgs e)
{
- if (sender == null)
- {
- throw new ResourceNotFoundException(nameof(sender));
- }
-
- var connection = (IWebSocketConnection)sender;
+ var connection = sender as IWebSocketConnection ?? throw new ResourceNotFoundException(nameof(sender));
_logger.LogDebug("Removing websocket from session {Session}", _session.Id);
_sockets.Remove(connection);
connection.Closed -= OnConnectionClosed;