diff --git a/src/input.c b/src/input.c
index 5e1abe5..9439b07 100644
--- a/src/input.c
+++ b/src/input.c
@@ -628,9 +628,9 @@ static void input_joyaxis(const SDLKey axis, const int value) {
  */
 static void input_joyevent(const int event, const SDLKey button) {
   int i;
-  for(i = 0; strcmp(keybindNames[i], "end");i++)
-    if(input_keybinds[i]->type == KEYBIND_JBUTTON &&
-       input_keybinds[i]->key == button)
+  for(i = 0; strcmp(keybindNames[i], "end"); i++)
+    if((input_keybinds[i]->type == KEYBIND_JBUTTON) &&
+       (input_keybinds[i]->key == button))
       input_key(i, event, 0.);
 }