diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2021-02-22 21:00:04 -0500 |
|---|---|---|
| committer | Joshua M. Boniface <joshua@boniface.me> | 2021-02-26 21:01:50 -0500 |
| commit | ab054d6239b1f58ee7037cfbab8a38c8d06ae1c7 (patch) | |
| tree | a0d0381889954a008add666d96fa899802990f70 /Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs | |
| parent | 19ff447e51d90575fd9de82a0ba8a3055f1a502a (diff) | |
Merge pull request #5290 from Bond-009/nullref
Fix possible null ref exception
(cherry picked from commit 1442a63556e87f1318ff091df81c4ffa083de699)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
Diffstat (limited to 'Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs')
| -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; |
