summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.hpp2
-rw-r--r--src/pugixpath.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index dacd8cd..b87aeb4 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -2215,7 +2215,7 @@ namespace pugi
* \param index - requested index
* \return element
*/
- xpath_node operator[](size_t index) const;
+ const xpath_node& operator[](size_t index) const;
/**
* Get begin constant iterator for collection
diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp
index 6239ed2..80368ff 100644
--- a/src/pugixpath.cpp
+++ b/src/pugixpath.cpp
@@ -792,9 +792,10 @@ namespace pugi
return size() == 0;
}
- xpath_node xpath_node_set::operator[](size_t index) const
+ const xpath_node& xpath_node_set::operator[](size_t index) const
{
- return (index >= size()) ? xpath_node() : m_begin[index];
+ assert(index < size());
+ return m_begin[index];
}
xpath_node_set::iterator xpath_node_set::mut_begin()