[gnome-software/wip/addons-can-be-NULL] packagekit: Check for non-NULL addons returned by gs_app_dup_addons()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/addons-can-be-NULL] packagekit: Check for non-NULL addons returned by gs_app_dup_addons()
- Date: Fri, 13 May 2022 07:29:49 +0000 (UTC)
commit 617040440d207b45479d907671663489d25f6794
Author: Milan Crha <mcrha redhat com>
Date: Fri May 13 09:28:16 2022 +0200
packagekit: Check for non-NULL addons returned by gs_app_dup_addons()
Otherwise a runtime warning is printed on the console.
plugins/packagekit/gs-plugin-packagekit.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c
index ca630e60b..863469b93 100644
--- a/plugins/packagekit/gs-plugin-packagekit.c
+++ b/plugins/packagekit/gs-plugin-packagekit.c
@@ -621,7 +621,7 @@ gs_plugin_app_install (GsPlugin *plugin,
gs_app_set_state (app, GS_APP_STATE_INSTALLING);
- for (i = 0; i < gs_app_list_length (addons); i++) {
+ for (i = 0; addons != NULL && i < gs_app_list_length (addons); i++) {
GsApp *addon = gs_app_list_index (addons, i);
if (gs_app_get_to_be_installed (addon))
gs_app_set_state (addon, GS_APP_STATE_INSTALLING);
@@ -636,7 +636,7 @@ gs_plugin_app_install (GsPlugin *plugin,
error);
g_mutex_unlock (&self->task_mutex);
if (!gs_plugin_packagekit_results_valid (results, error)) {
- for (i = 0; i < gs_app_list_length (addons); i++) {
+ for (i = 0; addons != NULL && i < gs_app_list_length (addons); i++) {
GsApp *addon = gs_app_list_index (addons, i);
if (gs_app_get_state (addon) == GS_APP_STATE_INSTALLING)
gs_app_set_state_recover (addon);
@@ -646,7 +646,7 @@ gs_plugin_app_install (GsPlugin *plugin,
}
/* state is known */
- for (i = 0; i < gs_app_list_length (addons); i++) {
+ for (i = 0; addons != NULL && i < gs_app_list_length (addons); i++) {
GsApp *addon = gs_app_list_index (addons, i);
if (gs_app_get_state (addon) == GS_APP_STATE_INSTALLING) {
gs_app_set_state (addon, GS_APP_STATE_INSTALLED);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]