Blob Blame History Raw
From 4d2523b482ab78134dafc02c9b99bd15f1a9174a Mon Sep 17 00:00:00 2001
From: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
Date: Sun, 14 Jan 2018 23:28:15 +0100
Subject: [PATCH 1/1] libnma/cert-chooser: handle case of no avalable modules

Cause: Apparently it's perfectly okay if the list of modules is empty
(e.g., NULL).  However, the code assume that this indicates an error,
tries to print the NULL error, and crashes.

[lkundrak@v3.sk: cosmetic changes]

https://bugzilla.gnome.org/show_bug.cgi?id=785674
(cherry picked from commit a37483c1a364ef3cc1cfa29e7ad51ca108d75674)
---
 src/libnma/nma-cert-chooser-button.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libnma/nma-cert-chooser-button.c b/src/libnma/nma-cert-chooser-button.c
index c7089390..00651765 100644
--- a/src/libnma/nma-cert-chooser-button.c
+++ b/src/libnma/nma-cert-chooser-button.c
@@ -93,10 +93,10 @@ modules_initialized (GObject *object, GAsyncResult *res, gpointer user_data)
 	gchar *label;
 
 	modules = gck_modules_initialize_registered_finish (res, &error);
-	if (!modules) {
+	if (error) {
 		/* The Front Fell Off. */
-		g_critical ("Error getting registered modules: %s", error->message);
-		g_error_free (error);
+		g_warning ("Error getting registered modules: %s", error->message);
+		g_clear_error (&error);
 	}
 
 	model = GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (self)));
-- 
2.14.3