]> jfr.im git - irc/hexchat/hexchat.git/commitdiff
Fix using negative index
authorTingPing <redacted>
Sat, 23 Aug 2014 18:13:34 +0000 (14:13 -0400)
committerTingPing <redacted>
Sat, 22 Nov 2014 04:22:47 +0000 (23:22 -0500)
src/fe-gtk/servlistgui.c

index 05069f3c4fe4482137219299f4c7b79fb81178a8..f43a225a32cbab143067ae7f25b3014b4b2092df 100644 (file)
@@ -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? */