app-system: Don't assume that gmenu_tree_load_sync() sets error
The function may return FALSE without setting the GError, so don't assume it is set to prevent a crash in that case. While at it, free the GError we were leaking before. https://bugzilla.gnome.org/show_bug.cgi?id=670418
This commit is contained in:
parent
097e56f4ab
commit
b990ed2c23
@ -320,7 +320,15 @@ on_apps_tree_changed_cb (GMenuTree *tree,
|
||||
|
||||
if (!gmenu_tree_load_sync (self->priv->apps_tree, &error))
|
||||
{
|
||||
g_warning ("Failed to load apps: %s", error->message);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("Failed to load apps: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Failed to load apps");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -411,7 +419,15 @@ on_settings_tree_changed_cb (GMenuTree *tree,
|
||||
g_hash_table_remove_all (self->priv->setting_id_to_app);
|
||||
if (!gmenu_tree_load_sync (self->priv->settings_tree, &error))
|
||||
{
|
||||
g_warning ("Failed to load settings: %s", error->message);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("Failed to load apps: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Failed to load apps");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user