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());
this.stream.getTracks().forEach(t => { if(this.stream) {
try { this.stream.getTracks().forEach(t => {
t.stop(); try {
} catch(e) { t.stop();
} } 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