0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-31 00:13:01 +08:00

Prevent depth underflow when printing documents

Since depth is unsigned this is actually well-defined but it's better to not
have the underflow anyway.
This commit is contained in:
Arseny Kapoulkine 2014-11-19 20:56:36 -08:00
parent 853b1977b8
commit c579d99649

View File

@ -3643,11 +3643,12 @@ PUGI__NS_BEGIN
}
node = node->parent;
depth--;
// write closing node
if (PUGI__NODETYPE(node) == node_element)
{
depth--;
if (indent_length)
text_output_indent(writer, indent, indent_length, depth);