[glib] GSettings schemas: allow for zero items in schema



commit 65b7a20c67406f9309b2b8e1e7d7aaef98b81d02
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Sep 26 11:21:55 2011 -0400

    GSettings schemas: allow for zero items in schema
    
    GVDB deals with empty lists by returning NULL for the list instead of a
    zero-length (non-NULL) strv.  We can work around that in GSettingsSchema
    by checking for the NULL case and treating it like a zero-length list.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=660147

 gio/gsettingsschema.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c
index d904bf7..25d8541 100644
--- a/gio/gsettingsschema.c
+++ b/gio/gsettingsschema.c
@@ -349,7 +349,7 @@ g_settings_schema_list (GSettingsSchema *schema,
       gint len;
 
       list = gvdb_table_list (schema->priv->table, "");
-      len = g_strv_length (list);
+      len = list ? g_strv_length (list) : 0;
 
       schema->priv->items = g_new (GQuark, len);
       j = 0;



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