summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_xml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src/jabber_xml.cpp')
-rw-r--r--protocols/JabberG/src/jabber_xml.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/protocols/JabberG/src/jabber_xml.cpp b/protocols/JabberG/src/jabber_xml.cpp
index 66cb7a73bc..def4bf2463 100644
--- a/protocols/JabberG/src/jabber_xml.cpp
+++ b/protocols/JabberG/src/jabber_xml.cpp
@@ -132,7 +132,9 @@ TiXmlElement* XmlAddChild(TiXmlElement *hXml, const char *name)
if (hXml == nullptr)
return nullptr;
- return hXml->GetDocument()->NewElement(name);
+ auto *res = hXml->GetDocument()->NewElement(name);
+ hXml->InsertEndChild(res);
+ return res;
}
TiXmlElement* XmlAddChild(TiXmlElement *hXml, const char *name, const char *value)
@@ -141,7 +143,9 @@ TiXmlElement* XmlAddChild(TiXmlElement *hXml, const char *name, const char *valu
return nullptr;
auto *res = hXml->GetDocument()->NewElement(name);
- res->SetText(value);
+ if (value)
+ res->SetText(value);
+ hXml->InsertEndChild(res);
return res;
}
@@ -151,7 +155,9 @@ TiXmlElement* XmlAddChild(TiXmlElement *hXml, const char *name, int value)
return nullptr;
auto *res = hXml->GetDocument()->NewElement(name);
- res->SetText(value);
+ if (value)
+ res->SetText(value);
+ hXml->InsertEndChild(res);
return res;
}