]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix crash when .schema.xml is not installed
authorYuuki Harano <masm+github@masm11.me>
Sat, 21 Nov 2020 08:18:49 +0000 (17:18 +0900)
committerJeff Walsh <jeff.walsh@drtusers-MacBook-Pro.local>
Tue, 24 Nov 2020 01:24:41 +0000 (12:24 +1100)
* src/pgtkfns.c (parse_resource_key): Check return value.

src/pgtkfns.c

index f1ad9ca2725006fdfdb4756656cb2666b6a23c9c..494cbc72826743da8defb1c1ac3739298dc1805f 100644 (file)
@@ -1861,10 +1861,13 @@ parse_resource_key (const char *res_key, char *setting_key)
   /* check existence of setting_key */
   GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default ();
   GSettingsSchema *scm = g_settings_schema_source_lookup (ssrc, SCHEMA_ID, FALSE);
-  if (!g_settings_schema_has_key (scm, setting_key)) {
-    g_settings_schema_unref (scm);
-    return NULL;
-  }
+  if (!scm)
+    return NULL;       /* *.schema.xml is not installed. */
+  if (!g_settings_schema_has_key (scm, setting_key))
+    {
+      g_settings_schema_unref (scm);
+      return NULL;
+    }
 
   /* create GSettings, and return it */
   GSettings *gs = g_settings_new_full (scm, NULL, path);