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
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2016-03-20 02:00:06 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-03-20 02:00:06 +0300
commit4279a769d301cffa174660c8690411922d17b8e6 (patch)
tree48c820615142824f59deefc2ce17e1c58a194b8b /lib/file.js
parent47fcd1ff390930e01ee3c5f23cc7286b6d51856d (diff)
Fix uncaught exception "torrent is destroyed"
Fix https://github.com/feross/webtorrent-app/issues/160
Diffstat (limited to 'lib/file.js')
-rw-r--r--lib/file.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/file.js b/lib/file.js
index b8bcc1b..fd24e0e 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -82,7 +82,9 @@ File.prototype.createReadStream = function (opts) {
fileStream._notify()
})
eos(fileStream, function () {
- self._torrent.deselect(fileStream._startPiece, fileStream._endPiece, true)
+ if (!self._torrent.destroyed) {
+ self._torrent.deselect(fileStream._startPiece, fileStream._endPiece, true)
+ }
})
return fileStream
}