Commit 50ad751e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Protect against stream being null in connection.close.

This may happen if we close a connection before getting any tracks.
parent 65637c18
...@@ -56,12 +56,14 @@ Connection.prototype.close = function(sendit) { ...@@ -56,12 +56,14 @@ Connection.prototype.close = function(sendit) {
while(this.timers.length > 0) while(this.timers.length > 0)
clearInterval(this.timers.pop()); clearInterval(this.timers.pop());
if(this.stream) {
this.stream.getTracks().forEach(t => { this.stream.getTracks().forEach(t => {
try { try {
t.stop(); t.stop();
} catch(e) { } catch(e) {
} }
}); });
}
this.pc.close(); this.pc.close();
if(sendit) { if(sendit) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment