diff --git a/lib/middleware/parameter.js b/lib/middleware/parameter.js index 044acd9f2..5305641bd 100644 --- a/lib/middleware/parameter.js +++ b/lib/middleware/parameter.js @@ -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反馈该问题'); - } };