Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe ALLEGRO <jipai13@gmail.com>2020-10-05 00:22:54 +0300
committerGitHub <noreply@github.com>2020-10-05 00:22:54 +0300
commitf83f370e541807cedacfc0e93dbff08cadb4a18a (patch)
tree484bf26d532d80bdb2cd4c3f94ba28d0cc2abc29 /lib
parent7aee819796c540df0b247fec1853098f9a591d4c (diff)
check if torrent is destroyed before emitting download/upload event
closes https://github.com/webtorrent/webtorrent/issues/1924
Diffstat (limited to 'lib')
-rw-r--r--lib/torrent.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index caa6687..0fb0145 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -921,7 +921,7 @@ class Torrent extends EventEmitter {
this._downloadSpeed(downloaded)
this.client._downloadSpeed(downloaded)
this.emit('download', downloaded)
- this.client.emit('download', downloaded)
+ if (this.client) this.client.emit('download', downloaded)
})
wire.on('upload', uploaded => {
@@ -930,7 +930,7 @@ class Torrent extends EventEmitter {
this._uploadSpeed(uploaded)
this.client._uploadSpeed(uploaded)
this.emit('upload', uploaded)
- this.client.emit('upload', uploaded)
+ if (this.client) this.client.emit('upload', uploaded)
})
this.wires.push(wire)