From 57b57522bb98aa3256f0b5b888c525ff04cde027 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 23 Apr 2014 15:38:50 +0200 Subject: [PATCH] style --- index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 73fffdd..39afa50 100644 --- a/index.js +++ b/index.js @@ -127,15 +127,16 @@ module.exports = function (metadata) { } ut_metadata.prototype._onRequest = function (piece) { - if (this._metadataComplete) { - var start = piece * PIECE_LENGTH - var end = start + PIECE_LENGTH - if (end > this._metadataSize) { - end = this._metadataSize - } - var buf = this.metadata.slice(start, end) - this._data(piece, buf, this._metadataSize) + if (!this._metadataComplete) { + return } + var start = piece * PIECE_LENGTH + var end = start + PIECE_LENGTH + if (end > this._metadataSize) { + end = this._metadataSize + } + var buf = this.metadata.slice(start, end) + this._data(piece, buf, this._metadataSize) } ut_metadata.prototype._onData = function (piece, buf, totalSize) {