From 46b823c60df606de714f6be06f65f36916c1212d Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sun, 30 Jun 2013 16:01:31 -0400 Subject: [PATCH] Fix a bug with the youtube error parser --- get-info.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/get-info.js b/get-info.js index 159298c8..9afb5b74 100644 --- a/get-info.js +++ b/get-info.js @@ -30,7 +30,12 @@ function getJSON(options, callback) { catch(e) { Logger.errlog.log("JSON fail: " + options.path); var m = buffer.match(/([^<]+)<\/internalReason>/); - callback(m[1] || true, res.statusCode, null); + if(m) { + callback(m[1], res.statusCode, null); + } + else { + callback(true, res.statusCode, null); + } return; } callback(false, res.statusCode, data); @@ -55,7 +60,12 @@ function getJSONHTTPS(options, callback) { catch(e) { Logger.errlog.log("JSON fail: " + options.path); var m = buffer.match(/([^<]+)<\/internalReason>/); - callback(m[1] || true, res.statusCode, null); + if(m) { + callback(m[1], res.statusCode, null); + } + else { + callback(true, res.statusCode, null); + } return; } callback(false, res.statusCode, data);