[goffice] go_conf_set_str_list: handle empty list.



commit 436cf8c4390e944eed53f20649bdf7076bda0a0e
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 26 11:53:15 2010 -0400

    go_conf_set_str_list: handle empty list.

 ChangeLog                     |    5 +++++
 goffice/app/go-conf-keyfile.c |    8 +++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 223f828..0d91716 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-26  Morten Welinder  <terra gnome org>
+
+	* goffice/app/go-conf-keyfile.c (go_conf_set_str_list): Handle
+	empty list.
+
 2010-03-26  Valek Filippov  <frob gnome org>
 
 	* goffice/canvas/goc-polygon.c (goc_polygon_prepare_draw): use polygon
diff --git a/goffice/app/go-conf-keyfile.c b/goffice/app/go-conf-keyfile.c
index 84a4e28..d92dac3 100644
--- a/goffice/app/go-conf-keyfile.c
+++ b/goffice/app/go-conf-keyfile.c
@@ -182,13 +182,11 @@ go_conf_set_str_list (GOConfNode *node, gchar const *key, GSList *list)
 	gchar **strs = NULL;
 	int i, ns;
 
-	/* eh? */
-	if (list == NULL)
-		return;
-
 	real_key = go_conf_get_real_key (node, key);
 	ns = g_slist_length (list);
-	strs = g_new (gchar *, ns);
+
+	/* +1 to ensure we don't get a NULL */
+	strs = g_new (gchar *, ns + 1);
 
 	for (i = 0; i < ns; i++) {
 		const gchar *lstr = list->data;



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