Fix assertion when no gsettings schema installed
authorPatrick Griffis <tingping@tingping.se>
Mon, 26 Feb 2018 01:18:41 +0000 (20:18 -0500)
committerSimon McVittie <smcv@debian.org>
Thu, 1 Mar 2018 09:21:46 +0000 (09:21 +0000)
Fixes #1455

Closes: #1456
Approved by: mwleeds
Applied-upstream: 1.11.4, commit:82f993e1c79911f5241c67f2347136156bf9909c

Gbp-Pq: Name Fix-assertion-when-no-gsettings-schema-installed.patch

common/flatpak-utils.c

index 9b18be3a4e0f238f5932e8c981034cd181a972c6..afa15909e79fea600f2342ac6c3402d62817ff7b 100644 (file)
@@ -524,19 +524,26 @@ flatpak_get_gtk_theme (void)
     {
       /* The schema may not be installed so check first */
       GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
-      g_autoptr(GSettingsSchema) schema = g_settings_schema_source_lookup (source,
-                                            "org.gnome.desktop.interface", FALSE);
+      g_autoptr(GSettingsSchema) schema = NULL;
 
-      if (schema == NULL)
-        g_once_init_leave (&gtk_theme, g_strdup (""));
+      if (source == NULL)
+          g_once_init_leave (&gtk_theme, g_strdup (""));
       else
         {
-          /* GSettings is used to store the theme if you use Wayland or GNOME.
-           * TODO: Check XSettings Net/ThemeName for other desktops.
-           * We don't care about any other method (like settings.ini) because they
-           *   aren't passed through the sandbox anyway. */
-          g_autoptr(GSettings) settings = g_settings_new ("org.gnome.desktop.interface");
-          g_once_init_leave (&gtk_theme, g_settings_get_string (settings, "gtk-theme"));
+          schema = g_settings_schema_source_lookup (source,
+                                                    "org.gnome.desktop.interface", FALSE);
+
+          if (schema == NULL)
+            g_once_init_leave (&gtk_theme, g_strdup (""));
+          else
+            {
+              /* GSettings is used to store the theme if you use Wayland or GNOME.
+               * TODO: Check XSettings Net/ThemeName for other desktops.
+               * We don't care about any other method (like settings.ini) because they
+               *   aren't passed through the sandbox anyway. */
+              g_autoptr(GSettings) settings = g_settings_new ("org.gnome.desktop.interface");
+              g_once_init_leave (&gtk_theme, g_settings_get_string (settings, "gtk-theme"));
+            }
         }
     }