summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-11-19 20:56:36 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2014-11-19 20:56:36 -0800
commitc579d99649bae59aaf5344e3d428201113fab1e9 (patch)
tree4244be8486fa59253f7d29643e1bafaa319e67cc /src
parent853b1977b83797ce4ceb9d235f0dafad344b2270 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 90befd8..961e5f3 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -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);