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:
authorJohn Hiesey <john@hiesey.com>2021-04-13 23:14:52 +0300
committerJohn Hiesey <john@hiesey.com>2021-04-13 23:14:52 +0300
commit02a61cb51c2a589733cc77264a37956eec6ec225 (patch)
tree63b5cccd613a6176f23971318958d1854d1ca2ea /lib
parentd41cd7905238f5078d639b3ee243c7c7e85d7c63 (diff)
Make file.downloaded getter not throw when destroyed
Diffstat (limited to 'lib')
-rw-r--r--lib/file.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/file.js b/lib/file.js
index caa395d..e39d5d7 100644
--- a/lib/file.js
+++ b/lib/file.js
@@ -36,7 +36,7 @@ class File extends EventEmitter {
}
get downloaded () {
- if (!this._torrent.bitfield) return 0
+ if (this._destroyed || !this._torrent.bitfield) return 0
const { pieces, bitfield, pieceLength, lastPieceLength } = this._torrent
const { _startPiece: start, _endPiece: end } = this