From 02a61cb51c2a589733cc77264a37956eec6ec225 Mon Sep 17 00:00:00 2001 From: John Hiesey Date: Tue, 13 Apr 2021 13:14:52 -0700 Subject: Make file.downloaded getter not throw when destroyed --- lib/file.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3