summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-08-29 13:28:04 +0100
committerDavid Baker <dbkr@matrix.org>2014-08-29 13:28:39 +0100
commitcc413be4461ee58c6ada8828b61b22a403d5d65d (patch)
tree146c11589c57431ad94d173947f0b3bd747731b3
parentGet the equalities right. (diff)
downloadsynapse-cc413be4461ee58c6ada8828b61b22a403d5d65d.tar.xz
Don't break if the call ends before it connects
Diffstat (limited to '')
-rw-r--r--webclient/components/matrix/matrix-call.js32
1 files changed, 20 insertions, 12 deletions
diff --git a/webclient/components/matrix/matrix-call.js b/webclient/components/matrix/matrix-call.js
index b66c914d7b..45d00ee792 100644
--- a/webclient/components/matrix/matrix-call.js
+++ b/webclient/components/matrix/matrix-call.js
@@ -76,12 +76,16 @@ angular.module('MatrixCall', [])
     MatrixCall.prototype.hangup = function() {
         console.trace("Ending call "+this.call_id);
 
-        forAllTracksOnStream(this.localAVStream, function(t) {
-            t.stop();
-        });
-        forAllTracksOnStream(this.remoteAVStream, function(t) {
-            t.stop();
-        });
+        if (this.localAVStream) {
+            forAllTracksOnStream(this.localAVStream, function(t) {
+                t.stop();
+            });
+        }
+        if (this.remoteAVStream) {
+            forAllTracksOnStream(this.remoteAVStream, function(t) {
+                t.stop();
+            });
+        }
 
         var content = {
             version: 0,
@@ -246,12 +250,16 @@ angular.module('MatrixCall', [])
     MatrixCall.prototype.onHangupReceived = function() {
         this.state = 'ended';
 
-        forAllTracksOnStream(this.localAVStream, function(t) {
-            t.stop();
-        });
-        forAllTracksOnStream(this.remoteAVStream, function(t) {
-            t.stop();
-        });
+        if (this.localAVStream) {
+            forAllTracksOnStream(this.localAVStream, function(t) {
+                t.stop();
+            });
+        }
+        if (this.remoteAVStream) {
+            forAllTracksOnStream(this.remoteAVStream, function(t) {
+                t.stop();
+            });
+        }
 
         this.onHangup();
     };