diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-11-19 20:56:36 -0800 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2014-11-19 20:56:36 -0800 |
commit | c579d99649bae59aaf5344e3d428201113fab1e9 (patch) | |
tree | 4244be8486fa59253f7d29643e1bafaa319e67cc | |
parent | 853b1977b83797ce4ceb9d235f0dafad344b2270 (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.
-rw-r--r-- | src/pugixml.cpp | 3 |
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); |