From 894e2156ed323495d66e241fc3dcc8cdd78f956e Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 9 Sep 2015 10:16:24 +1200 Subject: [PATCH] preventing options being created if it doesn't exist --- lib/youtube-dl.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/youtube-dl.js b/lib/youtube-dl.js index 293806f..b96101a 100644 --- a/lib/youtube-dl.js +++ b/lib/youtube-dl.js @@ -52,7 +52,7 @@ var ytdl = module.exports = function(videoUrl, args, options) { 'Host': url.parse(item.url).hostname }; - if ((options || {}).start > 0) { + if (options && options.start > 0) { headers.Range = "bytes=" + options.start + "-"; } @@ -62,7 +62,7 @@ var ytdl = module.exports = function(videoUrl, args, options) { }); req.on('response', function(res) { - if ((options || {}).start > 0 && res.statusCode == 416) { + if (options && options.start > 0 && res.statusCode == 416) { // the file that is being resumed is complete. stream.emit('end'); return;