From e53b0fc7c7e264a421fcd8ff82d2b51a50e4483c Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Sun, 31 Aug 2008 01:54:51 -0300 Subject: [PATCH] If GIO cannot enumerate directory, set error and return --- backend/gio/gio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/gio/gio.c b/backend/gio/gio.c index f430f84..a0cb790 100644 --- a/backend/gio/gio.c +++ b/backend/gio/gio.c @@ -73,14 +73,23 @@ gio_enumerate_entries (AtomCtx *ctx, AtomEntry ***entries, size_t *len) GFileEnumerator *enumerator; GFileInfo *info; GFile *file; + GError *error; gchar *root; gchar *name; gchar *filename; GPtrArray *array; root = atom_config_get_str (ctx, "gio", "root"); dir = g_file_new_for_path (root); + error = NULL; enumerator = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, - G_FILE_QUERY_INFO_NONE, NULL, NULL); + G_FILE_QUERY_INFO_NONE, NULL, &error); + if (enumerator == NULL) + { + AtomError *aerr = atom_error_new_from_gerror (error); + atom_error_set (ctx, aerr); + g_error_free (error); + return; + } array = g_ptr_array_new (); while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL) { -- 2.20.1