Skip to content

Commit

Permalink
Fix a bug which occurs when the heading has no children (#34)
Browse files Browse the repository at this point in the history
* Fix a bug which occurs when the heading has no children
  ```TypeError: Cannot read property 'type' of undefined```
  • Loading branch information
asmsuechan authored and medfreeman committed Mar 23, 2017
1 parent 64a3eb3 commit d00ce1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Expand Up @@ -171,7 +171,8 @@ export default function(md, options) {

if (heading.type === "inline") {
let content
if (heading.children && heading.children[0].type === "link_open") {
if (heading.children.length > 0 &&
heading.children[0].type === "link_open") {
// headings that contain links have to be processed
// differently since nested links aren't allowed in markdown
content = heading.children[1].content
Expand Down

0 comments on commit d00ce1b

Please sign in to comment.