Explorar o código

dataChannel can be null before initialization

afrokick %!s(int64=6) %!d(string=hai) anos
pai
achega
31bd3d67ee
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      lib/negotiator.ts

+ 3 - 2
lib/negotiator.ts

@@ -193,8 +193,9 @@ export class Negotiator {
       const dataConnection = <DataConnection>this.connection;
       const dataChannel = dataConnection.dataChannel;
 
-      dataChannelNotClosed =
-        dataChannel.readyState && dataChannel.readyState !== "closed";
+      if (dataChannel) {
+        dataChannelNotClosed = !!dataChannel.readyState && dataChannel.readyState !== "closed";
+      }
     }
 
     if (peerConnectionNotClosed || dataChannelNotClosed) {