[gnome-software] Don't perform a lookup when the category is NULL
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Don't perform a lookup when the category is NULL
- Date: Wed, 2 Mar 2016 12:11:37 +0000 (UTC)
commit 9f3fc8fc3f085b35d948d29b5ed8670b8e590fe6
Author: William Hua <william hua canonical com>
Date: Mon Feb 29 17:44:40 2016 -0500
Don't perform a lookup when the category is NULL
Some desktop files like fslint.desktop have a NULL category entry that
causes a segfault when trying to do a lookup in get_app_folder ().
src/gs-folders.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-folders.c b/src/gs-folders.c
index f4abca4..02768e4 100644
--- a/src/gs-folders.c
+++ b/src/gs-folders.c
@@ -450,12 +450,17 @@ static GsFolder *
get_app_folder (GsFolders *folders, const gchar *app, GPtrArray *categories)
{
GsFolder *folder;
+ const gchar *category;
guint i;
folder = g_hash_table_lookup (folders->apps, app);
if (!folder && categories) {
for (i = 0; i < categories->len; i++) {
- folder = g_hash_table_lookup (folders->categories, g_ptr_array_index (categories, i));
+ category = g_ptr_array_index (categories, i);
+ if (category == NULL)
+ continue;
+
+ folder = g_hash_table_lookup (folders->categories, category);
if (folder) {
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]