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.
This commit is contained in:
anime
2025-07-09 16:22:38 +08:00
parent 9886e4d146
commit ea1b76f5b7

View File

@@ -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) {