From bf996f2fd118dd6181e98d5e47be80cd1ee07c9c Mon Sep 17 00:00:00 2001 From: reality Date: Fri, 13 Sep 2013 14:54:17 +0000 Subject: [PATCH] that should do it --- modules/imgur/imgur.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/imgur/imgur.js b/modules/imgur/imgur.js index 42cffde..9bd255c 100644 --- a/modules/imgur/imgur.js +++ b/modules/imgur/imgur.js @@ -109,7 +109,7 @@ var imgur = function(dbot) { 'getGoodRandomImage': function(callback) { this.api.getRandomImage(function(url, slug, hash) { this.api.getImageInfo(slug, function(imgData) { - if(imgData && imgData.data && imgData.data.height > 500 && imgData.data.width > 500) { + if(!_.isUndefined(imgData) && imgData.data && imgData.data.height > 500 && imgData.data.width > 500) { callback(url, imgData); } else { this.api.getGoodRandomImage(callback); @@ -220,7 +220,7 @@ var imgur = function(dbot) { 'Authorization': 'Client-ID ' + this.config.apikey } }, function(err, response, body) { - if(body.data && body.data[0] != undefined) { + if(!_.isUndefined(body) && body.data && body.data[0] != undefined) { var num = _.random(0, body.data.length - 1); this.api.getGalleryInfo(body.data[num].id, function(gal) { event.reply(local + ': ' + gal.data.link + ' [' +