fix: empty item error

This commit is contained in:
DIYgod
2019-06-13 11:35:59 +08:00
parent 7c5fcaccc5
commit 1c6e71cfb7
+2 -6
View File
@@ -3,8 +3,8 @@ const he = require('he');
module.exports = async (ctx, next) => {
await next();
if (ctx.state.data && ctx.state.data.item.length === 0) {
throw Error('该路由目前获取内容为空,请检查源站情况或前往https://github.com/DIYgod/RSSHub/issues反馈该问题');
if (ctx.state.data && (!ctx.state.data.item || ctx.state.data.item.length === 0)) {
throw Error('该路由目前获取内容为空,请检查源站情况或前往 https://github.com/DIYgod/RSSHub/issues 反馈该问题');
}
// decode HTML entities
@@ -59,8 +59,4 @@ module.exports = async (ctx, next) => {
return item;
});
}
if (ctx.state.data && ctx.state.data.item.length === 0) {
throw Error('该路由目前获取内容为空,请检查源站情况或前往https://github.com/DIYgod/RSSHub/issues反馈该问题');
}
};