summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-02-19 18:29:07 -0500
committerRay Strode <rstrode@redhat.com>2010-02-19 18:29:07 -0500
commit4e0bbe71059d5eeca65aabe25b803622fd6c4d78 (patch)
tree0b1fd2a84184abe0c5c3c0745e6e76c5ac7511de
parent6283523615ca51ed462f26ba60c4245a4259ac01 (diff)
downloadgconf-4e0bbe71059d5eeca65aabe25b803622fd6c4d78.tar.gz
Avoid a crash when gconftool-2 can't read the db
-rw-r--r--gconf/gconf.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gconf/gconf.c b/gconf/gconf.c
index 964d0968..4261524b 100644
--- a/gconf/gconf.c
+++ b/gconf/gconf.c
@@ -511,6 +511,7 @@ gconf_engine_get_local (const gchar* address,
{
GConfEngine* conf;
GConfSource* source;
+ GConfSources* sources;
g_return_val_if_fail(address != NULL, NULL);
g_return_val_if_fail(err == NULL || *err == NULL, NULL);
@@ -519,10 +520,14 @@ gconf_engine_get_local (const gchar* address,
if (source == NULL)
return NULL;
-
+
+ sources = gconf_sources_new_from_source(source);
+ if (sources == NULL)
+ return NULL;
+
conf = gconf_engine_blank(FALSE);
- conf->local_sources = gconf_sources_new_from_source(source);
+ conf->local_sources = sources;
g_assert (gconf_engine_is_local (conf));
@@ -534,13 +539,19 @@ gconf_engine_get_local_for_addresses (GSList *addresses,
GError **err)
{
GConfEngine *conf;
+ GConfSources* sources;
g_return_val_if_fail (addresses != NULL, NULL);
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
+ sources = gconf_sources_new_from_addresses (addresses, err);
+
+ if (sources == NULL)
+ return NULL;
+
conf = gconf_engine_blank (FALSE);
- conf->local_sources = gconf_sources_new_from_addresses (addresses, err);
+ conf->local_sources = sources;
g_assert (gconf_engine_is_local (conf));