diff --git a/src/commands/fun/gelbooru.js b/src/commands/fun/gelbooru.js index 8ffe0b6..4e482ca 100644 --- a/src/commands/fun/gelbooru.js +++ b/src/commands/fun/gelbooru.js @@ -149,7 +149,7 @@ module.exports = { var tries = 0; var posts; - while (posts.length == 0 && (tries++) < 5) + while ((!posts || posts.length == 0) && (tries++) < 5) posts = await Booru.search(booru, searchTags, { limit: 1, random: true, credentials: credentials[booru] ?? null }); const post = posts[Math.floor(Math.random() * posts.length)];