diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-01-06 08:14:40 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-01-06 08:14:40 +0300 |
commit | 436d0bd76197b324df0dd37bcd8b73b317a629a1 (patch) | |
tree | fb8241239870a3c5662593e47b8fb4648fce39fb /lib | |
parent | 882ae811f89580216e3e429f9038c64265ab2f2d (diff) | |
parent | a473f29f34f76981a40cf6c64cb54c298939684e (diff) |
Merge pull request #555 from feross/fix-downloaded-property
Fix downloaded property access
Diffstat (limited to 'lib')
-rw-r--r-- | lib/torrent.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 0cf8b3a..973a2ac 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -105,6 +105,7 @@ Object.defineProperty(Torrent.prototype, 'timeRemaining', { // Bytes completed (excluding invalid data) Object.defineProperty(Torrent.prototype, 'downloaded', { get: function () { + if (!this.bitfield) return 0 var downloaded = 0 for (var index = 0, len = this.pieces.length; index < len; ++index) { if (this.bitfield.get(index)) { // verified data |