[recipes] Silently ignore empty lines in ingredients lists



commit 4b0fce951b14124e9dff2a20b48443ac6634364e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 19 13:46:07 2017 -0500

    Silently ignore empty lines in ingredients lists
    
    These just tend to happen at the end of test data files,
    and ignoring them is not causing us any harm.

 src/gr-ingredients-list.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-ingredients-list.c b/src/gr-ingredients-list.c
index b837511..0bb05d6 100644
--- a/src/gr-ingredients-list.c
+++ b/src/gr-ingredients-list.c
@@ -78,9 +78,12 @@ gr_ingredients_list_populate (GrIngredientsList  *ingredients,
                 Ingredient *ing;
                 g_autoptr(GError) local_error = NULL;
 
+                if (lines[i][0] == '\0')
+                        continue;
+
                 fields = g_strsplit (lines[i], "\t", 0);
                 if (g_strv_length (fields) != 4) {
-                        g_warning ("wrong number of fields, ignoring line '%s'", lines[i]);
+                        g_warning ("wrong number of fields, ignoring line %d: '%s'", i, lines[i]);
                         continue;
                 }
 


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