From 456fbd77db9902665beee0d0a969dc04e7e9c6df Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Fri, 25 Mar 2022 17:38:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/search/[keyword].js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pages/search/[keyword].js b/pages/search/[keyword].js index c00b6764..8f0cf779 100644 --- a/pages/search/[keyword].js +++ b/pages/search/[keyword].js @@ -120,7 +120,10 @@ async function filterByMemCache (allPosts, keyword) { let hitCount = 0 for (const i in indexContent) { const c = indexContent[i] - const index = c.toLowerCase().indexOf(keyword.toLowerCase()) + if (!c) { + continue + } + const index = c.toLowerCase().indexOf(keyword.toLowerCase()) || -1 if (index > -1) { hit = true hitCount += 1