diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2017-04-14 01:15:12 +0300 |
---|---|---|
committer | Joseph Frazier <1212jtraceur@gmail.com> | 2017-04-14 01:15:12 +0300 |
commit | b192765512af98a475dfc8c6b98799b876a92f92 (patch) | |
tree | f84d60211adb14811238b700355c1c6b9f53a4a8 | |
parent | 873be1411054332d21b0e5b65f8508a243615a26 (diff) |
Fix uncaught exception (#1103)
Fixes: https://github.com/feross/webtorrent/issues/1100
Fixes: https://github.com/feross/webtorrent/issues/1101
-rw-r--r-- | lib/torrent.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 661c30c..dd49c1d 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1498,6 +1498,8 @@ Torrent.prototype._request = function (wire, index, hotswap) { var chunkLength = isWebSeed ? piece.chunkLengthRemaining(reservation) : piece.chunkLength(reservation) wire.request(index, chunkOffset, chunkLength, function onChunk (err, chunk) { + if (self.destroyed) return + // TODO: what is this for? if (!self.ready) return self.once('ready', function () { onChunk(err, chunk) }) |