remove opportunity for imgur np
This commit is contained in:
3
bot.js
3
bot.js
@@ -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.
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user