diff --git a/libgnucash/app-utils/gnc-gsettings.cpp b/libgnucash/app-utils/gnc-gsettings.cpp index 40aac9dd71..ab8e23349d 100644 --- a/libgnucash/app-utils/gnc-gsettings.cpp +++ b/libgnucash/app-utils/gnc-gsettings.cpp @@ -105,7 +105,21 @@ static GSettings * gnc_gsettings_get_settings_obj (const gchar *schema_str) auto full_name_str = normalize_schema_name (schema_str); auto full_name = full_name_str.c_str(); auto schema_source {g_settings_schema_source_get_default()}; + if (!schema_source) + { + PWARN ("No GSettings schema source available; cannot access schema %s", full_name); + LEAVE(""); + return nullptr; + } + auto schema {g_settings_schema_source_lookup(schema_source, full_name, true)}; + if (!schema) + { + PWARN ("GSettings schema %s not found", full_name); + LEAVE(""); + return nullptr; + } + auto gset = g_settings_new_full (schema, nullptr, nullptr); DEBUG ("Created gsettings object %p for schema %s", gset, full_name); @@ -545,6 +559,12 @@ gnc_settings_dump_schema_paths (void) gchar **non_relocatable; auto schema_source {g_settings_schema_source_get_default()}; + if (!schema_source) + { + PWARN ("No GSettings schema source available; cannot dump schema paths"); + return; + } + g_settings_schema_source_list_schemas (schema_source, true, &non_relocatable, nullptr);