From 916e9141d9a5a482a40722f80d2cbb64d28651dc Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Thu, 5 Mar 2026 14:41:47 +0800 Subject: [PATCH] fix(plugin-md-power): fix potential null pointer exceptions when parsing collapse containers (#866) --- plugins/plugin-md-power/src/node/container/collapse.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/plugin-md-power/src/node/container/collapse.ts b/plugins/plugin-md-power/src/node/container/collapse.ts index 8042bac2..560010f9 100644 --- a/plugins/plugin-md-power/src/node/container/collapse.ts +++ b/plugins/plugin-md-power/src/node/container/collapse.ts @@ -109,10 +109,10 @@ function parseCollapse(tokens: Token[], index: number, attrs: CollapseMeta): num idx++ const inlineToken = tokens[i + 2] - const firstToken = inlineToken.children![0] + const firstToken = inlineToken.children?.[0] let flag: string = '' let expand: boolean | undefined - if (firstToken.type === 'text') { + if (firstToken?.type === 'text') { firstToken.content = firstToken.content.trim().replace(/^:[+\-]\s*/, (match) => { flag = match.trim() return ''