[recipes/recipes-1.0] Avoid a crash in the recipe importer
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/recipes-1.0] Avoid a crash in the recipe importer
- Date: Sun, 21 May 2017 16:59:27 +0000 (UTC)
commit 00ca8bd8ffeacb5935538ff807c5f5bf682be4bc
Author: Matthias Clasen <mclasen redhat com>
Date: Tue May 16 08:10:44 2017 -0400
Avoid a crash in the recipe importer
When no chef information is provided, we should show
an error right away instead of crashing later.
src/gr-recipe-importer.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-recipe-importer.c b/src/gr-recipe-importer.c
index d6bb843..3c15cf1 100644
--- a/src/gr-recipe-importer.c
+++ b/src/gr-recipe-importer.c
@@ -751,6 +751,7 @@ import_chefs (GrRecipeImporter *importer)
g_autoptr(GKeyFile) keyfile = NULL;
g_autofree char *path = NULL;
g_autoptr(GError) error = NULL;
+ gsize length;
g_assert (importer->chefs_keyfile == NULL);
g_assert (importer->chef_ids == NULL);
@@ -764,7 +765,14 @@ import_chefs (GrRecipeImporter *importer)
}
importer->chefs_keyfile = g_key_file_ref (keyfile);
- importer->chef_ids = g_key_file_get_groups (keyfile, NULL);
+ importer->chef_ids = g_key_file_get_groups (keyfile, &length);
+ if (length == 0) {
+ g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ _("No chef information found"));
+ error_cb (importer->extractor, error, importer);
+ return FALSE;
+ }
+
return import_next_chef (importer);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]