diff options
| author | Bond_009 <bond.009@outlook.com> | 2021-02-22 13:13:31 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2021-02-22 13:13:31 +0100 |
| commit | 93a1f434a31072416736d2003e62d2162fc157d2 (patch) | |
| tree | b5cb6fd0e3adbda3624e242cc6a15b6dc2349ba6 | |
| parent | 0beda0e32c3e80719700a708b4c9864698cd8f24 (diff) | |
Fix possible null ref exception
| -rw-r--r-- | Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs index 9486874d5..a12a6b26c 100644 --- a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs +++ b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs @@ -1,3 +1,5 @@ +#nullable enable + using System.Net.Sockets; using System.Threading; using System.Threading.Tasks; @@ -29,7 +31,7 @@ namespace Emby.Server.Implementations.EntryPoints /// <summary> /// The UDP server. /// </summary> - private UdpServer _udpServer; + private UdpServer? _udpServer; private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); private bool _disposed = false; @@ -71,9 +73,8 @@ namespace Emby.Server.Implementations.EntryPoints } _cancellationTokenSource.Cancel(); - _udpServer.Dispose(); _cancellationTokenSource.Dispose(); - _cancellationTokenSource = null; + _udpServer?.Dispose(); _udpServer = null; _disposed = true; |
