aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--smime/ChangeLog5
-rw-r--r--smime/gui/e-cert-selector.c28
2 files changed, 20 insertions, 13 deletions
diff --git a/smime/ChangeLog b/smime/ChangeLog
index a389558c4a..57a290a4ce 100644
--- a/smime/ChangeLog
+++ b/smime/ChangeLog
@@ -1,3 +1,8 @@
+2003-12-10 Not Zed <NotZed@Ximian.com>
+
+ * gui/e-cert-selector.c (e_cert_selector_new): if we get no
+ matching certs, show empty menu rather than crashing. #51922.
+
2003-12-05 JP Rosevear <jpr@ximian.com>
* lib/e-cert.c: fix for C89
diff --git a/smime/gui/e-cert-selector.c b/smime/gui/e-cert-selector.c
index b3fcabdc43..9c64ebb37e 100644
--- a/smime/gui/e-cert-selector.c
+++ b/smime/gui/e-cert-selector.c
@@ -176,19 +176,21 @@ e_cert_selector_new(int type, const char *currentid)
certlist = CERT_FindUserCertsByUsage(CERT_GetDefaultCertDB(), usage, FALSE, TRUE, NULL);
ecs->priv->certlist = certlist;
- node = CERT_LIST_HEAD(certlist);
- while (!CERT_LIST_END(node, certlist)) {
- w = gtk_menu_item_new_with_label(node->cert->nickname);
- gtk_menu_shell_append((GtkMenuShell *)menu, w);
- gtk_widget_show(w);
-
- if (currentid != NULL
- && (strcmp(node->cert->nickname, currentid) == 0
- || strcmp(node->cert->emailAddr, currentid) == 0))
- active = n;
-
- n++;
- node = CERT_LIST_NEXT(node);
+ if (certlist != NULL) {
+ node = CERT_LIST_HEAD(certlist);
+ while (!CERT_LIST_END(node, certlist)) {
+ w = gtk_menu_item_new_with_label(node->cert->nickname);
+ gtk_menu_shell_append((GtkMenuShell *)menu, w);
+ gtk_widget_show(w);
+
+ if (currentid != NULL
+ && (strcmp(node->cert->nickname, currentid) == 0
+ || strcmp(node->cert->emailAddr, currentid) == 0))
+ active = n;
+
+ n++;
+ node = CERT_LIST_NEXT(node);
+ }
}
gtk_option_menu_set_menu((GtkOptionMenu *)p->menu, menu);