From 4279a769d301cffa174660c8690411922d17b8e6 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sat, 19 Mar 2016 16:00:06 -0700 Subject: Fix uncaught exception "torrent is destroyed" Fix https://github.com/feross/webtorrent-app/issues/160 --- lib/file.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/file.js') 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 } -- cgit v1.2.3