From 2270daa6cccb9246ec3f4e7f4d40bdf674148a31 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 28 Nov 2011 15:38:23 +0100 Subject: [PATCH] glib: catalog: Skip empty entries When parsing the catalog file we use g_key_file_get_string() instead of g_key_file_get_string_list(), and then split the string into parts. For string lists, the last character is a ';' so if the user doesn't know this, we add an empty string to the array, leading to errors further on. Therefore, skip empty strings. https://bugs.freedesktop.org/show_bug.cgi?id=43305 --- lib/packagekit-glib2/pk-catalog.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lib/packagekit-glib2/pk-catalog.c b/lib/packagekit-glib2/pk-catalog.c index 36bf138..1db98fe 100644 --- a/lib/packagekit-glib2/pk-catalog.c +++ b/lib/packagekit-glib2/pk-catalog.c @@ -169,7 +169,8 @@ pk_catalog_process_type_part (PkCatalogState *state, PkCatalogMode mode, const g /* split using any of the delimiters and add to correct array*/ list = g_strsplit_set (data, ";, ", 0); for (i=0; list[i] != NULL; i++) - g_ptr_array_add (array, g_strdup (list[i])); + if (list[i][0]) + g_ptr_array_add (array, g_strdup (list[i])); out: g_strfreev (list); g_free (key); -- 1.7.5.1.217.g4e3aa.dirty