diff options
| author | crobibero <cody@robibe.ro> | 2020-11-13 11:24:46 -0700 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-11-13 11:24:46 -0700 |
| commit | 95ebb9a55ace6c544fa7fa15d0a255a5cee752a8 (patch) | |
| tree | f5ce2c6ea994d63712d45772ad712ac6bcf79ab6 /Emby.Server.Implementations/Session/WebSocketController.cs | |
| parent | 5f52a58e785fa4ae06fa07a93b81c1e7547ac9f3 (diff) | |
Use null coalescing when possible
Diffstat (limited to 'Emby.Server.Implementations/Session/WebSocketController.cs')
| -rw-r--r-- | Emby.Server.Implementations/Session/WebSocketController.cs | 7 |
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; |
