Modified: freeswitch/trunk/src/include/switch_xml.h (16603 => 16604)
--- freeswitch/trunk/src/include/switch_xml.h 2010-02-11 15:18:52 UTC (rev 16603)
+++ freeswitch/trunk/src/include/switch_xml.h 2010-02-11 15:54:41 UTC (rev 16604)
@@ -96,6 +96,8 @@
switch_xml_t parent;
/*! flags */
uint32_t flags;
+ /*! is_switch_xml_root bool */
+ switch_bool_t is_switch_xml_root_t;
};
/*!
Modified: freeswitch/trunk/src/switch_xml.c (16603 => 16604)
--- freeswitch/trunk/src/switch_xml.c 2010-02-11 15:18:52 UTC (rev 16603)
+++ freeswitch/trunk/src/switch_xml.c 2010-02-11 15:54:41 UTC (rev 16604)
@@ -397,6 +397,12 @@
while (root->xml.parent)
root = (switch_xml_root_t) root->xml.parent; /* root tag */
+
+ /* Make sure root is really a switch_xml_root_t (Issues with switch_xml_toxml) */
+ if (!root->xml.is_switch_xml_root_t) {
+ return NULL;
+ }
+
for (i = 0; root->attr[i] && xml->name && strcmp(xml->name, root->attr[i][0]); i++);
if (!root->attr[i])
return NULL; /* no matching default attributes */
@@ -2343,6 +2349,7 @@
strcpy(root->err, root->xml.txt = (char *) "");
root->ent = (char **) memcpy(malloc(sizeof(ent)), ent, sizeof(ent));
root->attr = root->pi = (char ***) (root->xml.attr = SWITCH_XML_NIL);
+ root->xml.is_switch_xml_root_t = SWITCH_TRUE;
return &root->xml;
}