summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2010-08-05 13:58:20 +0200
committerTomas Bzatek <tbzatek@redhat.com>2010-08-05 13:58:20 +0200
commitdfb5eaffb71a423592df228c09bb4a44bda05d6d (patch)
treec659d82b7b01fdadc7d58ec2dbd640a56448624b
parent814e1d55b15f02b07b0c27d8d13f17ae6a2a6d71 (diff)
downloadgconf-dfb5eaffb71a423592df228c09bb4a44bda05d6d.tar.gz
[gsettings] Handle empty lists on migration
g_variant_new() doesn't like empty array-typed GVariantBuilder instances. See bug 625663 for details.
-rw-r--r--gsettings/gsettings-data-convert.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/gsettings/gsettings-data-convert.c b/gsettings/gsettings-data-convert.c
index 4effcb5b..07ccbe8a 100644
--- a/gsettings/gsettings-data-convert.c
+++ b/gsettings/gsettings-data-convert.c
@@ -183,13 +183,18 @@ handle_file (const gchar *filename)
case GCONF_VALUE_STRING:
builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
list = gconf_value_get_list (value);
- for (l = list; l; l = l->next)
+ if (list != NULL)
{
- GConfValue *lv = l->data;
- s = gconf_value_get_string (lv);
- g_variant_builder_add (builder, "s", s);
+ for (l = list; l; l = l->next)
+ {
+ GConfValue *lv = l->data;
+ s = gconf_value_get_string (lv);
+ g_variant_builder_add (builder, "s", s);
+ }
+ v = g_variant_new ("as", builder);
}
- v = g_variant_new ("as", builder);
+ else
+ v = g_variant_new_array (G_VARIANT_TYPE_STRING, NULL, 0);
g_variant_ref_sink (v);
if (dry_run)
@@ -209,13 +214,18 @@ handle_file (const gchar *filename)
case GCONF_VALUE_INT:
builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
list = gconf_value_get_list (value);
- for (l = list; l; l = l->next)
+ if (list != NULL)
{
- GConfValue *lv = l->data;
- ii = gconf_value_get_int (lv);
- g_variant_builder_add (builder, "i", ii);
+ for (l = list; l; l = l->next)
+ {
+ GConfValue *lv = l->data;
+ ii = gconf_value_get_int (lv);
+ g_variant_builder_add (builder, "i", ii);
+ }
+ v = g_variant_new ("ai", builder);
}
- v = g_variant_new ("ai", builder);
+ else
+ v = g_variant_new_array (G_VARIANT_TYPE_INT32, NULL, 0);
g_variant_ref_sink (v);
if (dry_run)