From 27ec5a0b37cc756f01bc5b9f05bc92c6a7ec400e Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 21 Oct 2009 20:37:25 +0000 Subject: XPath: Fixed empty string literals, don't add empty nodes/attributes in node sets (i.e. for self axis) git-svn-id: http://pugixml.googlecode.com/svn/trunk@172 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixpath.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index b6d089c..ac4de31 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -820,6 +820,7 @@ namespace pugi void contents_clear() { + if (m_cur_lexeme_contents) m_cur_lexeme_contents[0] = 0; m_clc_size = 0; } @@ -1434,6 +1435,8 @@ namespace pugi void step_push(xpath_node_set& ns, const xml_attribute& a, const xml_node& parent) { + if (!a) return; + // There are no attribute nodes corresponding to attributes that declare namespaces // That is, "xmlns:..." or "xmlns" if (!strncmp(a.name(), "xmlns", 5) && (a.name()[5] == 0 || a.name()[5] == ':')) return; @@ -1461,6 +1464,8 @@ namespace pugi void step_push(xpath_node_set& ns, const xml_node& n) { + if (!n) return; + switch (m_test) { case nodetest_name: -- cgit v1.2.3