From ea1b76f5b7c2f10ce80efea85e022a64d8d9ca06 Mon Sep 17 00:00:00 2001 From: anime Date: Wed, 9 Jul 2025 16:22:38 +0800 Subject: [PATCH] fix(getPageContentText): add null check for postContent before accessing length property Ensure postContent exists before checking its length property to prevent potential runtime errors when postContent is null or undefined. --- lib/notion/getPageContentText.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/notion/getPageContentText.js b/lib/notion/getPageContentText.js index 06a11f7f..0e52083b 100644 --- a/lib/notion/getPageContentText.js +++ b/lib/notion/getPageContentText.js @@ -168,7 +168,7 @@ export function getPageContentText(post, pageBlockMap) { const postContent = post.content let contentTextList = [] // 防止搜到加密文章的内容 - if (postContent.length > 0 && !post.password) { + if (postContent && postContent.length > 0 && !post.password) { for (const postContentId of postContent) { const blockContentText = getBlockContentText(postContentId) if (blockContentText) {