[gnome-software/wip/rancell/reviews] Fix a crash when the category is NULL.
- From: William Hua <williamhua src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/rancell/reviews] Fix a crash when the category is NULL.
- Date: Mon, 29 Feb 2016 22:45:34 +0000 (UTC)
commit 7ba4c264a6eaff0ec694e384de001b25c49a7e04
Author: William Hua <william hua canonical com>
Date: Mon Feb 29 17:44:40 2016 -0500
Fix a crash when the category is NULL.
fslint.desktop has a blank category entry that causes a segfault here.
src/gs-folders.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-folders.c b/src/gs-folders.c
index f4abca4..c290f51 100644
--- a/src/gs-folders.c
+++ b/src/gs-folders.c
@@ -450,12 +450,18 @@ 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) {
+ 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]