[dconf] dconf reader: don't crash without config database
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf] dconf reader: don't crash without config database
- Date: Wed, 2 Jun 2010 17:28:10 +0000 (UTC)
commit 34c250cd7fa388624759a6f9de649bc4e2335e61
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Jun 2 19:27:34 2010 +0200
dconf reader: don't crash without config database
Avoid null-pointer dereference when there's no ~/.config/dconf file.
engine/dconf-engine.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index e708890..14054c9 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -49,9 +49,13 @@ dconf_engine_read (DConfEngine *engine,
table = gvdb_table_new (filename, FALSE, NULL);
g_free (filename);
- value = gvdb_table_get_value (table, key, NULL);
-
- gvdb_table_unref (table);
+ if (table)
+ {
+ value = gvdb_table_get_value (table, key, NULL);
+ gvdb_table_unref (table);
+ }
+ else
+ value = NULL;
return value;
}
@@ -200,9 +204,13 @@ dconf_engine_list (DConfEngine *engine,
table = gvdb_table_new (filename, FALSE, NULL);
g_free (filename);
- list = gvdb_table_list (table, dir);
-
- gvdb_table_unref (table);
+ if (table)
+ {
+ list = gvdb_table_list (table, dir);
+ gvdb_table_unref (table);
+ }
+ else
+ list = NULL;
if (list == NULL)
list = g_new0 (char *, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]