Index: gnome-settings-daemon/gnome-settings-mouse.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/gnome-settings-mouse.c,v
retrieving revision 1.19
diff -u -p -r1.19 gnome-settings-mouse.c
--- gnome-settings-daemon/gnome-settings-mouse.c	10 Apr 2006 12:45:08 -0000	1.19
+++ gnome-settings-daemon/gnome-settings-mouse.c	13 Apr 2006 06:00:15 -0000
@@ -70,7 +70,9 @@ configure_button_layout (guchar   *butto
       }
       /* swap the buttons */
       buttons[left_button - 1] = right_button;
-      buttons[i] = left_button;
+
+      if (i != n_buttons)
+          buttons[i] = left_button;
     }
   /* check if we are not left_handed but are swapped */
   else if (!left_handed && buttons[left_button - 1] == right_button)
@@ -82,7 +84,9 @@ configure_button_layout (guchar   *butto
               break;
       }
       /* swap the buttons */
-      buttons[i] = right_button;
+      if (i != n_buttons)
+          buttons[i] = right_button;
+
       buttons[left_button - 1] = left_button;
   }
 }
