[goffice] go-conf: avoid crash on missing schema.



commit 4326dc2448371b2bb65434cc4a8400d48570bbb4
Author: Morten Welinder <terra gnome org>
Date:   Fri Oct 21 16:14:00 2011 -0400

    go-conf: avoid crash on missing schema.

 ChangeLog                       |    5 +++++
 goffice/app/go-conf-gsettings.c |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 28fdc2e..c7391f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-21  Morten Welinder  <terra gnome org>
+
+	* goffice/app/go-conf-gsettings.c (go_conf_get_node): Add
+	precondition.
+
 2011-10-21  Jean Brefort  <jean brefort normalesup org>
 
 	* configure.in: make GSettings the default configuration backend.
diff --git a/goffice/app/go-conf-gsettings.c b/goffice/app/go-conf-gsettings.c
index 3b23048..b19ca80 100644
--- a/goffice/app/go-conf-gsettings.c
+++ b/goffice/app/go-conf-gsettings.c
@@ -57,8 +57,11 @@ GOConfNode *
 go_conf_get_node (GOConfNode *parent, gchar const *key)
 {
 	GOConfNode *node;
+	char *formatted;
 
-	char *formatted = go_conf_format_id (key);
+	g_return_val_if_fail (parent || key, NULL);
+
+	formatted = go_conf_format_id (key);
 	node = g_new0 (GOConfNode, 1);
 	if (parent) {
 		if (key && !parent->key) {



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