diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-03-20 02:00:06 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-03-20 02:00:06 +0300 |
commit | 4279a769d301cffa174660c8690411922d17b8e6 (patch) | |
tree | 48c820615142824f59deefc2ce17e1c58a194b8b /lib/file.js | |
parent | 47fcd1ff390930e01ee3c5f23cc7286b6d51856d (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.js | 4 |
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 } |