[json-glib] Fixed json_deserialize_pspec() to handle null nodes.



commit d3db7acc1f53491b6dd9637991a1eaf8bb5c5002
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Tue May 3 00:20:12 2011 +0900

    Fixed json_deserialize_pspec() to handle null nodes.
    
    This fixes deserialization to match serialization (bug 648539)

 json-glib/json-gobject.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/json-glib/json-gobject.c b/json-glib/json-gobject.c
index dfa4058..a653712 100644
--- a/json-glib/json-gobject.c
+++ b/json-glib/json-gobject.c
@@ -565,7 +565,19 @@ json_deserialize_pspec (GValue     *value,
       break;
 
     case JSON_NODE_NULL:
-      retval = FALSE;
+      if (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (value)) == G_TYPE_STRING)
+	{
+	  g_value_set_string (value, NULL);
+	  retval = TRUE;
+	}
+      else if (G_TYPE_FUNDAMENTAL (G_VALUE_TYPE (value)) == G_TYPE_OBJECT)
+	{
+	  g_value_set_object (value, NULL);
+	  retval = TRUE;
+	}
+      else
+	retval = FALSE;
+
       break;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]