From a37483c1a364ef3cc1cfa29e7ad51ca108d75674 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] 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
---
 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)));
-- 

