emacs-diffs
[Top][All Lists]
Advanced

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

feature/pgtk d6ef9af 100/100: Fix crash when .schema.xml is not installe


From: Yuuki Harano
Subject: feature/pgtk d6ef9af 100/100: Fix crash when .schema.xml is not installed
Date: Tue, 24 Nov 2020 08:02:46 -0500 (EST)

branch: feature/pgtk
commit d6ef9af82eafef33e117dd61aa3bd51a2464fcc6
Author: Yuuki Harano <masm+github@masm11.me>
Commit: Jeff Walsh <jeff.walsh@drtusers-MacBook-Pro.local>

    Fix crash when .schema.xml is not installed
    
    * src/pgtkfns.c (parse_resource_key): Check return value.
---
 src/pgtkfns.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index f1ad9ca..494cbc7 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]