diff options
Diffstat (limited to 'plugins/yaml/tree.c')
-rw-r--r-- | plugins/yaml/tree.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/yaml/tree.c b/plugins/yaml/tree.c index 5db82ec..4487f9d 100644 --- a/plugins/yaml/tree.c +++ b/plugins/yaml/tree.c @@ -270,7 +270,11 @@ static bool g_yaml_tree_build_node(GYamlCollection *collec, GYamlLine **lines, s /* Début d'un sous-ensemble */ else if (indent > expected) { - assert(last != NULL); + if (last == NULL) + { + result = false; + goto done; + } sub = g_yaml_collection_new(is_item); g_yaml_pair_set_collection(G_YAML_PAIR(last), sub); @@ -319,6 +323,13 @@ static bool g_yaml_tree_build_node(GYamlCollection *collec, GYamlLine **lines, s } last = G_YAML_NODE(g_yaml_pair_new(line)); + + if (last == NULL) + { + result = false; + goto done; + } + g_yaml_collection_add_node(collec, last); (*cur)++; @@ -353,7 +364,9 @@ GYamlNode *g_yaml_tree_get_root(const GYamlTree *tree) GYamlNode *result; /* Liste à retourner */ result = tree->root; - g_object_ref(G_OBJECT(result)); + + if (result != NULL) + g_object_ref(G_OBJECT(result)); return result; |