summaryrefslogtreecommitdiff
path: root/src/pugixml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r--src/pugixml.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 4b1d5ab..59e8f79 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -1352,7 +1352,11 @@ PUGI__NS_BEGIN
char_t* buffer = static_cast<char_t*>(xml_memory::allocate((length + 1) * sizeof(char_t)));
if (!buffer) return false;
- memcpy(buffer, contents, length * sizeof(char_t));
+ if (contents)
+ memcpy(buffer, contents, length * sizeof(char_t));
+ else
+ assert(length == 0);
+
buffer[length] = 0;
out_buffer = buffer;