diff --git a/gb.xml/src/CNode.cpp b/gb.xml/src/CNode.cpp index 568a5e96d..cedacb96e 100644 --- a/gb.xml/src/CNode.cpp +++ b/gb.xml/src/CNode.cpp @@ -291,6 +291,12 @@ END_METHOD BEGIN_METHOD(CNode_escapeContent, GB_STRING data) +if(!LENGTH(data)) +{ + GB.ReturnNull(); + return; +} + char *escapedData; size_t lenEscapedData; TextNode::escapeContent(STRING(data), LENGTH(data), escapedData, lenEscapedData); diff --git a/gb.xml/src/textnode.cpp b/gb.xml/src/textnode.cpp index 7093f20b2..5b8308887 100644 --- a/gb.xml/src/textnode.cpp +++ b/gb.xml/src/textnode.cpp @@ -58,6 +58,7 @@ void TextNode::escapeContent(const char *src, const size_t lenSrc, char *&dst, s { dst = (char*)src; lenDst = lenSrc; + if(!lenSrc || !src) return; char *posFound = strpbrk (dst, "<>&\""); while (posFound != 0) {