fix some segvs in eet_node
authordiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 4 Jul 2011 03:50:37 +0000 (03:50 +0000)
committerdiscomfitor <discomfitor@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 4 Jul 2011 03:50:37 +0000 (03:50 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eet@60958 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/eet_node.c

index ce5520c..7685014 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
         * Add functions to manipulate nodes:
             eet_node_children_get, eet_node_next_get, eet_node_parent_get,
             eet_node_type_get, eet_node_value_get, eet_node_name_get
+        * Fix segmentation faults in several eet_node functions
index 771fe13..12bb0e6 100644 (file)
@@ -213,6 +213,8 @@ eet_node_struct_child_new(const char *parent,
 {
    Eet_Node *n;
 
+   if (!child) return NULL;
+
    if (child->type != EET_G_UNKNOWN)
       return child;
 
@@ -254,6 +256,7 @@ eet_node_list_append(Eet_Node   *parent,
    const char *tmp;
    Eet_Node *nn;
 
+   if ((!parent) || (!child)) return;
    tmp = eina_stringshare_add(name);
 
    for (nn = parent->values; nn; nn = nn->next)
@@ -296,6 +299,7 @@ eet_node_struct_append(Eet_Node   *parent,
    Eet_Node *prev;
    Eet_Node *nn;
 
+   if ((!parent) || (!child)) return;
    if (parent->type != EET_G_UNKNOWN)
      {
         ERR("[%s] is not a structure. Will not insert [%s] in it",
@@ -343,6 +347,8 @@ eet_node_hash_add(Eet_Node   *parent,
 {
    Eet_Node *nn;
 
+   if ((!parent) || (!child)) return;
+
    /* No list found, so create it. */
    nn = eet_node_hash_new(name, key, child);