[gnome-software/1688-reloading-view-upon-install] gs-category-page: Check whether app list was returned, before using it
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1688-reloading-view-upon-install] gs-category-page: Check whether app list was returned, before using it
- Date: Mon, 22 Aug 2022 15:20:26 +0000 (UTC)
commit cb240fd27999fd9ab9e7bb38bb32012039e2ec87
Author: Milan Crha <mcrha redhat com>
Date: Mon Aug 22 16:53:36 2022 +0200
gs-category-page: Check whether app list was returned, before using it
When the load of the category apps had been cancelled or finished with an error,
the data->app is NULL, which produces a runtime warning when passing it to
gs_app_list_length().
src/gs-category-page.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-category-page.c b/src/gs-category-page.c
index a254452bc..70364c763 100644
--- a/src/gs-category-page.c
+++ b/src/gs-category-page.c
@@ -221,7 +221,7 @@ choose_top_carousel_apps (LoadCategoryData *data,
top_carousel_rand = g_rand_new_with_seed (top_carousel_seed);
g_debug ("Top carousel seed: %u", top_carousel_seed);
- for (guint i = 0; i < gs_app_list_length (data->apps); i++) {
+ for (guint i = 0; data->apps != NULL && i < gs_app_list_length (data->apps); i++) {
GsApp *app = gs_app_list_index (data->apps, i);
gboolean is_featured, is_recently_updated, is_hi_res;
@@ -299,7 +299,7 @@ load_category_finish (LoadCategoryData *data)
/* Apps to go in the top carousel */
top_carousel_apps = choose_top_carousel_apps (data, recently_updated_cutoff_secs);
- for (guint i = 0; i < gs_app_list_length (data->apps); i++) {
+ for (guint i = 0; data->apps != NULL && i < gs_app_list_length (data->apps); i++) {
GsApp *app = gs_app_list_index (data->apps, i);
gboolean is_featured, is_recently_updated;
guint64 release_date;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]