diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-11-26 09:07:09 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-11-26 09:07:09 -0800 |
commit | 677a22519a212093438f4e5a08d79f9c74013488 (patch) | |
tree | 25f3fdde93802f8dceceb06b7c3efbf70757cac3 /src | |
parent | f7613e98edbb8987e0e0ecfb3c789c7ee8d60017 (diff) | |
parent | 30c389623cb6e4e79adcb97c7f743830fcc843c0 (diff) |
Merge pull request #220 from nwellnhof/node_insert_fix
Don't allow insert_{before|after} root node
Diffstat (limited to 'src')
-rw-r--r-- | src/node.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -436,7 +436,7 @@ cmark_node_unlink(cmark_node *node) { int cmark_node_insert_before(cmark_node *node, cmark_node *sibling) { - if (!S_can_contain(node->parent, sibling)) { + if (!node->parent || !S_can_contain(node->parent, sibling)) { return 0; } @@ -467,7 +467,7 @@ cmark_node_insert_before(cmark_node *node, cmark_node *sibling) int cmark_node_insert_after(cmark_node *node, cmark_node *sibling) { - if (!S_can_contain(node->parent, sibling)) { + if (!node->parent || !S_can_contain(node->parent, sibling)) { return 0; } |