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:
authorFeross Aboukhadijeh <feross@feross.org>2016-01-06 08:14:40 +0300
committerFeross Aboukhadijeh <feross@feross.org>2016-01-06 08:14:40 +0300
commit436d0bd76197b324df0dd37bcd8b73b317a629a1 (patch)
treefb8241239870a3c5662593e47b8fb4648fce39fb /lib
parent882ae811f89580216e3e429f9038c64265ab2f2d (diff)
parenta473f29f34f76981a40cf6c64cb54c298939684e (diff)
Merge pull request #555 from feross/fix-downloaded-property
Fix downloaded property access
Diffstat (limited to 'lib')
-rw-r--r--lib/torrent.js1
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