[seahorse/gnome-3-2] Fix crash when adding a non-LDAP keyserver
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse/gnome-3-2] Fix crash when adding a non-LDAP keyserver
- Date: Mon, 14 Nov 2011 07:00:24 +0000 (UTC)
commit e33e47cb1d864f68dac89c5a29b30c3e34998e33
Author: Vincent Untz <vuntz gnome org>
Date: Thu Oct 13 19:09:04 2011 +0200
Fix crash when adding a non-LDAP keyserver
https://bugzilla.gnome.org/show_bug.cgi?id=661683
libseahorse/seahorse-prefs.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/libseahorse/seahorse-prefs.c b/libseahorse/seahorse-prefs.c
index 93f6c2f..8afbc7a 100644
--- a/libseahorse/seahorse-prefs.c
+++ b/libseahorse/seahorse-prefs.c
@@ -233,20 +233,21 @@ calculate_keyserver_uri (SeahorseWidget *swidget)
const gchar *host = NULL;
const gchar *port = NULL;
GtkWidget *widget;
- GList *types;
+ gchar **types;
gint active;
gchar *uri;
+ guint i;
/* Figure out the scheme */
widget = GTK_WIDGET (seahorse_widget_get_widget (swidget, "keyserver-type"));
g_return_val_if_fail (widget != NULL, NULL);
active = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
- if (active >= 0) {
- types = g_object_get_data (G_OBJECT (swidget), "keyserver-types");
- scheme = (const gchar*)g_list_nth_data (types, active);
- if (scheme && !scheme[0])
- scheme = NULL;
+ types = g_object_get_data (G_OBJECT (swidget), "keyserver-types");
+ if (active >= 0 && types) {
+ for (i = 0; types[i] != NULL && i < active; i++);
+ if (i == active && types[active] && types[active][0])
+ scheme = types[active];
}
/* The host */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]