浏览代码

Null Pointer fix

BaronGreenback 4 年之前
父节点
当前提交
eafb8cf652
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      RSSDP/SsdpDeviceLocator.cs

+ 5 - 5
RSSDP/SsdpDeviceLocator.cs

@@ -27,14 +27,14 @@ namespace Rssdp.Infrastructure
         /// </summary>
         public SsdpDeviceLocator(ISsdpCommunicationsServer communicationsServer)
         {
-            if (communicationsServer == null)
+            _CommunicationsServer = communicationsServer;
+
+            if (communicationsServer != null)
             {
-                throw new ArgumentNullException(nameof(communicationsServer));
+                // This can occur is dlna is enabled, but defined to run over https.
+                _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived;
             }
 
-            _CommunicationsServer = communicationsServer;
-            _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived;
-
             _Devices = new List<DiscoveredSsdpDevice>();
         }