[recipes] store: be more robust



commit df5aa2583ea5f677c33bf3095cf84813a4069f27
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Aug 15 10:31:41 2017 -0400

    store: be more robust
    
    I've run into situations where recipes were still on the
    shopping list, but not in the database. Avoid criticals
    in that case, and just ignore those recipes.

 src/gr-recipe-store.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/gr-recipe-store.c b/src/gr-recipe-store.c
index b48c6ac..c7f4e84 100644
--- a/src/gr-recipe-store.c
+++ b/src/gr-recipe-store.c
@@ -1890,8 +1890,10 @@ gr_recipe_store_get_shopping_list (GrRecipeStore *self)
                 GrRecipe *recipe;
 
                 recipe = g_hash_table_lookup (self->recipes, key);
-
-                list = g_list_append (list, g_object_ref (recipe));
+                if (recipe)
+                        list = g_list_append (list, g_object_ref (recipe));
+                else
+                        g_warning ("ignoring nonexisting recipe on shopping list: %s", key);
 
                 g_variant_unref (value);
                 g_free (key);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]