summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index c8de68a..1d390eb 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -4296,7 +4296,12 @@ PUGI__NS_BEGIN
PUGI__FN xml_parse_result load_buffer_impl(xml_document_struct* doc, xml_node_struct* root, void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own, char_t** out_buffer)
{
// check input buffer
- assert(contents || size == 0);
+ if ((contents==NULL) && (size!=0)) {
+ xml_parse_result result;
+ result.status = status_no_document_element;
+ return result;
+ }
+
// get actual encoding
xml_encoding buffer_encoding = impl::get_buffer_encoding(encoding, contents, size);