summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-01-17 21:41:11 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2016-01-17 21:41:11 -0800
commitc50061bd0359ee1822b08a7c18ee4adf55d6fb1d (patch)
tree4679a544c01b41030a19853e847b257c1e83d6be
parent01cb5c9563cc257e14a0093843d87621563d961f (diff)
iterator: handle NULL root.
-rw-r--r--src/iterator.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/iterator.c b/src/iterator.c
index c477f01..351b81f 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -89,6 +89,9 @@ cmark_event_type cmark_iter_get_event_type(cmark_iter *iter) {
cmark_node *cmark_iter_get_root(cmark_iter *iter) { return iter->root; }
void cmark_consolidate_text_nodes(cmark_node *root) {
+ if (root == NULL) {
+ return;
+ }
cmark_iter *iter = cmark_iter_new(root);
cmark_strbuf buf = GH_BUF_INIT;
cmark_event_type ev_type;