@@ -337,6 +337,8 @@ static inline str gap(const char* ref, const char* start, const char* end)
337 me->outer = gap(d->body, tag_start, tag_start);
337 me->outer = gap(d->body, tag_start, tag_start);
338#define P_TagClose \
338#define P_TagClose \
339 str nodes = node_commit(&d->nodes); \
339 str nodes = node_commit(&d->nodes); \
340+ if (d->nodes.used_back == 0) \
341+ return "Closing tag with no openning"; \
340 me = &d->nodes.nodes[d->nodes.size - d->nodes.used_back]; \
342 me = &d->nodes.nodes[d->nodes.size - d->nodes.used_back]; \
341 me->nodes = nodes; \
343 me->nodes = nodes; \
342 if (me->name.length != gap(d->body, name_start, name_end).length || \
344 if (me->name.length != gap(d->body, name_start, name_end).length || \