From 739a5ee2358e6caf18ca5bd6147c60f00edeee99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Tue, 8 Jan 2019 19:32:13 +0800 Subject: [PATCH] Hotfix: icourse163 (#1340) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 `TypeError: Cannot read property 'reduce' of null` 报错 --- lib/routes/icourse163/newest.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/routes/icourse163/newest.js b/lib/routes/icourse163/newest.js index f5bd823fa..42ce31f5e 100644 --- a/lib/routes/icourse163/newest.js +++ b/lib/routes/icourse163/newest.js @@ -32,7 +32,7 @@ module.exports = async (ctx) => { lectors += `${lector.realName || lector.nickName}、`; return lectors; }, ''); - const tags = item.mocTagDtos.reduce((tags, tag) => { + const tags = (item.mocTagDtos || []).reduce((tags, tag) => { tags += `${tag.name}、`; return tags; }, ''); @@ -59,7 +59,7 @@ module.exports = async (ctx) => { ${item.schoolPanel.name} ${lectors}
开课时间: ${startTimeString}

${media} - ${item.termPanel.jsonContent.replace('spContent=', '')} + ${(item.termPanel.jsonContent || '').replace('spContent=', '')} `; return {