summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-08-23 14:13:34 -0400
committerTingPing <tingping@tingping.se>2014-08-23 14:13:34 -0400
commitd1c40196e3a5087980c67b1a35928a3fff81c0ae (patch)
treef26293e403b16f1b7a07ae9926dacae149b529d5 /src/fe-gtk
parent9716185edf2fa2c3b0b9b9b453609522e8b91e61 (diff)
Fix using negative index
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/servlistgui.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/fe-gtk/servlistgui.c b/src/fe-gtk/servlistgui.c
index 05069f3c..f43a225a 100644
--- a/src/fe-gtk/servlistgui.c
+++ b/src/fe-gtk/servlistgui.c
@@ -1526,13 +1526,14 @@ servlist_logintypecombo_cb (GtkComboBox *cb, gpointer *userdata)
 
 	index = gtk_combo_box_get_active (cb);	/* starts at 0, returns -1 for invalid selections */
 
-	if (index != -1)
-	{
-		/* The selection is valid. It can be 0, which is the default type, but we need to allow
-		* that so that you can revert from other types. servlist_save() will dump 0 anyway.
-		*/
-		selected_net->logintype = login_types_conf[index];
-	}
+	if (index == -1)
+		return; /* Invalid */
+
+	/* The selection is valid. It can be 0, which is the default type, but we need to allow
+	 * that so that you can revert from other types. servlist_save() will dump 0 anyway.
+	 */
+	selected_net->logintype = login_types_conf[index];
+
 	if (login_types_conf[index] == LOGIN_CUSTOM)
 	{
 		gtk_notebook_set_current_page (GTK_NOTEBOOK (userdata), 2);		/* FIXME avoid hardcoding? */