[json-glib] array: Relax add_string_element() preconditions
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [json-glib] array: Relax add_string_element() preconditions
- Date: Fri, 26 Oct 2012 10:14:31 +0000 (UTC)
commit bf273f396c640c17da9f742433b4855232b2062e
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Oct 26 10:59:16 2012 +0100
    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 files changed, 1 insertions(+), 2 deletions(-)
---
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);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]