[grilo/fremantle] [core] Create null GValue when setting null to grl_data_set_string



commit 709bc49e18d36a5d60ab9021de2e0c02369c6d3d
Author: Xabier Rodriguez Calvar <xrcalvar igalia com>
Date:   Fri Apr 23 17:16:40 2010 +0200

    [core] Create null GValue when setting null to grl_data_set_string

 src/data/grl-data.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/data/grl-data.c b/src/data/grl-data.c
index dc1e4b3..f3de015 100644
--- a/src/data/grl-data.c
+++ b/src/data/grl-data.c
@@ -220,11 +220,15 @@ grl_data_set_string (GrlData *data,
                      GrlKeyID key,
                      const gchar *strvalue)
 {
-  GValue value = { 0 };
-  g_value_init (&value, G_TYPE_STRING);
-  g_value_set_string (&value, strvalue);
-  grl_data_set (data, key, &value);
-  g_value_unset (&value);
+  if (strvalue) {
+    GValue value = { 0 };
+    g_value_init (&value, G_TYPE_STRING);
+    g_value_set_string (&value, strvalue);
+    grl_data_set (data, key, &value);
+    g_value_unset (&value);
+  } else {
+    grl_data_set (data, key, NULL);
+  }
 }
 
 /**



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