fix: Empty anchors no longer crash the rendering process

This commit is contained in:
NGPixel
2017-05-01 22:01:45 -04:00
committed by Nicolas Giard
parent f2bcc378d5
commit a9ed499006
4 changed files with 113 additions and 449 deletions

View File

@@ -110,7 +110,7 @@ const parseTree = (content) => {
if (heading.type === 'inline') {
let content = ''
let anchor = ''
if (heading.children && heading.children[0].type === 'link_open') {
if (heading.children && heading.children.length > 0 && heading.children[0].type === 'link_open') {
content = heading.children[1].content
anchor = _.kebabCase(content)
} else {