summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--webclient/components/matrix/matrix-call.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/webclient/components/matrix/matrix-call.js b/webclient/components/matrix/matrix-call.js
index ef35717da6..16f22fe364 100644
--- a/webclient/components/matrix/matrix-call.js
+++ b/webclient/components/matrix/matrix-call.js
@@ -117,6 +117,8 @@ angular.module('MatrixCall', [])
     };
 
     MatrixCall.prototype.gotUserMediaForInvite = function(stream) {
+        if (!$rootScope.currentCall || $rootScope.currentCall.state == 'ended') return;
+
         this.localAVStream = stream;
         var audioTracks = stream.getAudioTracks();
         for (var i = 0; i < audioTracks.length; i++) {
@@ -140,6 +142,8 @@ angular.module('MatrixCall', [])
     };
 
     MatrixCall.prototype.gotUserMediaForAnswer = function(stream) {
+        if (!$rootScope.currentCall || $rootScope.currentCall.state == 'ended') return;
+
         this.localAVStream = stream;
         var audioTracks = stream.getAudioTracks();
         for (var i = 0; i < audioTracks.length; i++) {