From bf273f396c640c17da9f742433b4855232b2062e Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 26 Oct 2012 10:59:16 +0100 Subject: array: Relax add_string_element() preconditions The add_string_element() allows passing a NULL string as a shortcut to create a 'null' node; the preconditions on the arguments are too strict. --- json-glib/json-array.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'json-glib/json-array.c') diff --git a/json-glib/json-array.c b/json-glib/json-array.c index 44caf1e..f9d641e 100644 --- a/json-glib/json-array.c +++ b/json-glib/json-array.c @@ -556,9 +556,8 @@ json_array_add_string_element (JsonArray *array, JsonNode *node; g_return_if_fail (array != NULL); - g_return_if_fail (value != NULL); - if (value != NULL) + if (value != NULL && *value != '\0') { node = json_node_new (JSON_NODE_VALUE); json_node_set_string (node, value); -- cgit v1.2.1