fix crash when imgur shit innit

This commit is contained in:
reality 2013-09-13 14:35:19 +00:00
parent 3ff165f323
commit ef4ceac61e

View File

@ -109,7 +109,7 @@ var imgur = function(dbot) {
'getGoodRandomImage': function(callback) { 'getGoodRandomImage': function(callback) {
this.api.getRandomImage(function(url, slug, hash) { this.api.getRandomImage(function(url, slug, hash) {
this.api.getImageInfo(slug, function(imgData) { this.api.getImageInfo(slug, function(imgData) {
if(imgData.data && imgData.data.height > 500 && imgData.data.width > 500) { if(imgData && imgData.data && imgData.data.height > 500 && imgData.data.width > 500) {
callback(url, imgData); callback(url, imgData);
} else { } else {
this.api.getGoodRandomImage(callback); this.api.getGoodRandomImage(callback);