[dconf-editor/gnome-3-24] SettingsSchemaSource.get_default() could return null.



commit cd0d550122f4e2e78e2fb139aad951f4bb4fe404
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Oct 12 13:05:00 2017 +0200

    SettingsSchemaSource.get_default() could return null.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788862

 editor/dconf-model.vala |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index 83b6650..61f1c10 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -514,12 +514,28 @@ public class SettingsModel : Object, Gtk.TreeModel
 
     public SettingsModel ()
     {
-        SettingsSchemaSource settings_schema_source = SettingsSchemaSource.get_default ();
+        SettingsSchemaSource? settings_schema_source = SettingsSchemaSource.get_default ();
+        root = new Directory (null, "/", client);
+
+        if (settings_schema_source != null)
+            parse_schemas ((!) settings_schema_source);
+
+        create_dconf_views (root);
+
+        client.watch_sync ("/");
+    }
+
+    public Directory get_root_directory ()
+    {
+        return root;
+    }
+
+    private void parse_schemas (SettingsSchemaSource settings_schema_source)
+    {
         string [] non_relocatable_schemas;
         string [] relocatable_schemas;
-        settings_schema_source.list_schemas (true, out non_relocatable_schemas, out relocatable_schemas);
 
-        root = new Directory (null, "/", client);
+        settings_schema_source.list_schemas (true, out non_relocatable_schemas, out relocatable_schemas);
 
         foreach (string schema_id in non_relocatable_schemas)
         {
@@ -531,15 +547,6 @@ public class SettingsModel : Object, Gtk.TreeModel
             Directory view = create_gsettings_views (root, schema_path [1:schema_path.length]);
             view.init_gsettings_keys ((!) settings_schema);
         }
-
-        create_dconf_views (root);
-
-        client.watch_sync ("/");
-    }
-
-    public Directory get_root_directory ()
-    {
-        return root;
     }
 
     /*\


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