Commit 5a894c32 authored by Jan Alexander Steffens's avatar Jan Alexander Steffens Committed by Matthias Clasen

gsettings: Don't crash when no schemas are installed

Still doesn't behave well ("gsettings help" causes an error),
but at least there's no segfault anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=724847
parent f1c81da5
......@@ -697,7 +697,7 @@ main (int argc, char **argv)
if (argc < 2)
return gsettings_help (FALSE, NULL);
global_schema_source = g_settings_schema_source_ref (g_settings_schema_source_get_default ());
global_schema_source = g_settings_schema_source_get_default ();
if (argc > 3 && g_str_equal (argv[1], "--schemadir"))
{
......@@ -705,7 +705,6 @@ main (int argc, char **argv)
GError *error = NULL;
global_schema_source = g_settings_schema_source_new_from_directory (argv[2], parent, FALSE, &error);
g_settings_schema_source_unref (parent);
if (global_schema_source == NULL)
{
......@@ -719,6 +718,13 @@ main (int argc, char **argv)
argv = argv + 2;
argc -= 2;
}
else if (global_schema_source == NULL)
{
g_printerr (_("No schemas installed\n"));
return 1;
}
else
g_settings_schema_source_ref (global_schema_source);
need_settings = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment