remove opportunity for imgur np

This commit is contained in:
Dalton
2018-12-07 17:21:57 -08:00
parent 7bc39ca8b0
commit e94ac0cfed

3
bot.js
View File

@@ -130,7 +130,8 @@ function imgurRequest(subreddit, page_max) {
if (req.responseText !== "Not found") { if (req.responseText !== "Not found") {
try { try {
var json = JSON.parse(req.responseText); var json = JSON.parse(req.responseText);
returnText = json.data[getRandomInt(0, json.data.length - 1)].link; let json_data = json.data[getRandomInt(0, json.data.length - 1)];
if(json_data) { returnText = json_data.link; }
} catch (error) { } catch (error) {
// Ignore the error and let the calling method handle the empty string. // Ignore the error and let the calling method handle the empty string.
} }