[gnome-software] Do not crash if there is no /usr/share/appdata directory
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Do not crash if there is no /usr/share/appdata directory
- Date: Fri, 11 Oct 2013 10:56:34 +0000 (UTC)
commit 83c3904977d40c879fb92bbf653d9a57aa23c812
Author: Richard Hughes <richard hughsie com>
Date: Fri Oct 11 10:24:50 2013 +0100
Do not crash if there is no /usr/share/appdata directory
This can happen if no applications with AppData are installed on the system, and
gnome-software is run locally.
src/gs-plugin-loader.c | 6 ++++++
src/plugins/gs-plugin-appdata.c | 11 ++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 8166e3e..35c6a21 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -201,6 +201,12 @@ gs_plugin_loader_run_refine (GsPluginLoader *plugin_loader,
ret = plugin_func (plugin, list, flags, cancellable, error);
if (!ret)
goto out;
+ if (error != NULL && *error != NULL) {
+ ret = FALSE;
+ g_warning ("%s set %s but did not return FALSE!",
+ plugin->name, (*error)->message);
+ goto out;
+ }
gs_plugin_status_update (plugin, NULL, GS_PLUGIN_STATUS_FINISHED);
gs_profile_stop (plugin_loader->priv->profile, profile_id);
g_free (profile_id);
diff --git a/src/plugins/gs-plugin-appdata.c b/src/plugins/gs-plugin-appdata.c
index 19d4441..eb7487e 100644
--- a/src/plugins/gs-plugin-appdata.c
+++ b/src/plugins/gs-plugin-appdata.c
@@ -80,16 +80,21 @@ gs_plugin_destroy (GsPlugin *plugin)
static gboolean
gs_plugin_startup (GsPlugin *plugin, GError **error)
{
- gboolean ret = TRUE;
GDir *dir;
+ GError *error_local = NULL;
const gchar *tmp;
+ gboolean ret = TRUE;
gchar *ext_tmp;
gchar *id;
/* find all the files installed */
- dir = g_dir_open (plugin->priv->cachedir, 0, error);
- if (dir == NULL)
+ dir = g_dir_open (plugin->priv->cachedir, 0, &error_local);
+ if (dir == NULL) {
+ g_debug ("Could not open AppData directory: %s",
+ error_local->message);
+ g_error_free (error_local);
goto out;
+ }
while ((tmp = g_dir_read_name (dir)) != NULL) {
if (g_strcmp0 (tmp, "schema") == 0)
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]