diff --git a/static/js/directives/chat.js b/static/js/directives/chat.js index 6699f844..1b35c6ec 100644 --- a/static/js/directives/chat.js +++ b/static/js/directives/chat.js @@ -238,7 +238,7 @@ define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], subscope.sendChat = function(to, message, status, mid, noloop) { //console.log("send chat", to, scope.peer); var peercall = mediaStream.webrtc.findTargetCall(to); - if (peercall && peercall.peerconnection.datachannelReady) { + if (peercall && peercall.peerconnection && peercall.peerconnection.datachannelReady) { subscope.p2p(true); // Send out stuff through data channel. return subscope.sendChatPeer2Peer(peercall, to, message, status, mid, noloop);