aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuuki Harano2020-11-21 17:18:49 +0900
committerJeff Walsh2020-11-24 12:24:41 +1100
commitd6ef9af82eafef33e117dd61aa3bd51a2464fcc6 (patch)
treefd5c4e7a55e307dbb757e0c1d37385799da27b8e /src
parent731b5e8e318cf09d18d9821e9b0e24633e9204da (diff)
downloademacs-d6ef9af82eafef33e117dd61aa3bd51a2464fcc6.tar.gz
emacs-d6ef9af82eafef33e117dd61aa3bd51a2464fcc6.zip
Fix crash when .schema.xml is not installed
* src/pgtkfns.c (parse_resource_key): Check return value.
Diffstat (limited to 'src')
-rw-r--r--src/pgtkfns.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index f1ad9ca2725..494cbc72826 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -1861,10 +1861,13 @@ parse_resource_key (const char *res_key, char *setting_key)
1861 /* check existence of setting_key */ 1861 /* check existence of setting_key */
1862 GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default (); 1862 GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default ();
1863 GSettingsSchema *scm = g_settings_schema_source_lookup (ssrc, SCHEMA_ID, FALSE); 1863 GSettingsSchema *scm = g_settings_schema_source_lookup (ssrc, SCHEMA_ID, FALSE);
1864 if (!g_settings_schema_has_key (scm, setting_key)) { 1864 if (!scm)
1865 g_settings_schema_unref (scm); 1865 return NULL; /* *.schema.xml is not installed. */
1866 return NULL; 1866 if (!g_settings_schema_has_key (scm, setting_key))
1867 } 1867 {
1868 g_settings_schema_unref (scm);
1869 return NULL;
1870 }
1868 1871
1869 /* create GSettings, and return it */ 1872 /* create GSettings, and return it */
1870 GSettings *gs = g_settings_new_full (scm, NULL, path); 1873 GSettings *gs = g_settings_new_full (scm, NULL, path);