fix(plugin-md-power): fix potential null pointer exceptions when parsing collapse containers (#866)
This commit is contained in:
parent
ca51a345fb
commit
916e9141d9
@ -109,10 +109,10 @@ function parseCollapse(tokens: Token[], index: number, attrs: CollapseMeta): num
|
|||||||
idx++
|
idx++
|
||||||
|
|
||||||
const inlineToken = tokens[i + 2]
|
const inlineToken = tokens[i + 2]
|
||||||
const firstToken = inlineToken.children![0]
|
const firstToken = inlineToken.children?.[0]
|
||||||
let flag: string = ''
|
let flag: string = ''
|
||||||
let expand: boolean | undefined
|
let expand: boolean | undefined
|
||||||
if (firstToken.type === 'text') {
|
if (firstToken?.type === 'text') {
|
||||||
firstToken.content = firstToken.content.trim().replace(/^:[+\-]\s*/, (match) => {
|
firstToken.content = firstToken.content.trim().replace(/^:[+\-]\s*/, (match) => {
|
||||||
flag = match.trim()
|
flag = match.trim()
|
||||||
return ''
|
return ''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user