Fix empty RSS feed crash

This commit is contained in:
benji7425 2017-11-14 01:31:42 +00:00
parent 2e985ad5fa
commit f3c3e57e41
3 changed files with 17 additions and 8 deletions

View file

@ -1,5 +1,11 @@
# Changelog # Changelog
## v3.1.1
### Fixed
- Empty RSS feed crash
## v3.1.0 ## v3.1.0
### Added ### Added

View file

@ -77,6 +77,8 @@ module.exports = class FeedData {
return; return;
} }
if (articles.length > 0) {
const latest = normaliseUrl(articles[0].link); const latest = normaliseUrl(articles[0].link);
if (!this.cachedLinks.includes(latest)) { if (!this.cachedLinks.includes(latest)) {
@ -88,6 +90,7 @@ module.exports = class FeedData {
channel.send((role || "") + formatPost(articles[0])) channel.send((role || "") + formatPost(articles[0]))
.catch(err => DiscordUtil.dateError(`Error posting in ${channel.id}: ${err.message || err}`)); .catch(err => DiscordUtil.dateError(`Error posting in ${channel.id}: ${err.message || err}`));
} }
}
}); });
} }
}; };

View file

@ -1,5 +1,5 @@
{ {
"version": "3.1.0", "version": "3.1.1",
"main": "app/index.js", "main": "app/index.js",
"scripts": { "scripts": {
"postinstall": "cd ./discord-bot-core && npm install", "postinstall": "cd ./discord-bot-core && npm install",