[dconf/wip/reorg: 482/523] engine: allow for NULL value tables



commit dd27ef43b84334678f0085a8ec095b090560ce7b
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Jul 5 23:42:13 2012 -0400

    engine: allow for NULL value tables
    
    This will happen for user databases if the database has never written to
    (ie: first login to fresh user account).

 engine/dconf-engine.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index d8362f3..08558fd 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -537,7 +537,7 @@ dconf_engine_read (DConfEngine        *engine,
         }
 
       /* Step 4.  Check the first source. */
-      if (!found_key)
+      if (!found_key && engine->sources[0]->values)
         value = gvdb_table_get_value (engine->sources[0]->values, key);
 
       /* We already checked source #0 (or ignored it, as appropriate).
@@ -549,8 +549,13 @@ dconf_engine_read (DConfEngine        *engine,
 
   /* Step 5.  Check the remaining sources, until value != NULL. */
   for (i = lock_level; value == NULL && i < engine->n_sources; i++)
-    if ((value = gvdb_table_get_value (engine->sources[i]->values, key)))
-      break;
+    {
+      if (engine->sources[i]->values == NULL)
+        continue;
+
+      if ((value = gvdb_table_get_value (engine->sources[i]->values, key)))
+        break;
+    }
 
   dconf_engine_release_sources (engine);
 



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