diff options
| author | Patrick Griffis <tingping@tingping.se> | 2018-02-25 20:18:41 -0500 |
|---|---|---|
| committer | Patrick Griffis <tingping@tingping.se> | 2018-02-25 20:18:41 -0500 |
| commit | d74deb69d8c0add86ffe405f320993558a5b1c44 (patch) | |
| tree | 145af7187c111b4396052a7577baf920a1723c5a | |
| parent | 28f929f15e1a13bb007c951bffe71c17127f4a64 (diff) | |
| download | flatpak-d74deb69d8c0add86ffe405f320993558a5b1c44.tar.gz | |
Fix assertion when no gsettings schema installedschema-fix
Fixes #1455
| -rw-r--r-- | common/flatpak-utils.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 9b18be3a..afa15909 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -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 (>k_theme, g_strdup ("")); + if (source == NULL) + g_once_init_leave (>k_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 (>k_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 (>k_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 (>k_theme, g_settings_get_string (settings, "gtk-theme")); + } } } |
