* BUG: The XmlNode.Serialize() method does not crashes anymore if a null
  string is given.

git-svn-id: svn://localhost/gambas/trunk@5622 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Adrien Prokopowicz 2013-04-27 19:21:28 +00:00
parent 5e94fa80a4
commit 4321262fc5
2 changed files with 7 additions and 0 deletions

View file

@ -291,6 +291,12 @@ END_METHOD
BEGIN_METHOD(CNode_escapeContent, GB_STRING data) BEGIN_METHOD(CNode_escapeContent, GB_STRING data)
if(!LENGTH(data))
{
GB.ReturnNull();
return;
}
char *escapedData; size_t lenEscapedData; char *escapedData; size_t lenEscapedData;
TextNode::escapeContent(STRING(data), LENGTH(data), escapedData, lenEscapedData); TextNode::escapeContent(STRING(data), LENGTH(data), escapedData, lenEscapedData);

View file

@ -58,6 +58,7 @@ void TextNode::escapeContent(const char *src, const size_t lenSrc, char *&dst, s
{ {
dst = (char*)src; dst = (char*)src;
lenDst = lenSrc; lenDst = lenSrc;
if(!lenSrc || !src) return;
char *posFound = strpbrk (dst, "<>&\""); char *posFound = strpbrk (dst, "<>&\"");
while (posFound != 0) while (posFound != 0)
{ {