Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
You can get window events after shutting down the window, so don't ab…
Browse files Browse the repository at this point in the history
…ort the program if that happens.
  • Loading branch information
slouken committed Dec 11, 2012
1 parent 8f2299d commit de52fa2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/testjoystick.c
Expand Up @@ -250,11 +250,17 @@ main(int argc, char *argv[])
SDL_JoystickClose(joystick);
}

joystick = NULL;
if (keepGoing) {
joystick = NULL;
SDL_WaitEvent( &event );
if ( event.type == SDL_JOYDEVICEADDED ) {
printf("Waiting for attach\n");
}
while (keepGoing) {
SDL_WaitEvent(&event);
if (event.type == SDL_QUIT) {
keepGoing = SDL_FALSE;
} else if (event.type == SDL_JOYDEVICEADDED) {
joystick = SDL_JoystickOpen(atoi(argv[1]));
break;
}
}
}
Expand Down

0 comments on commit de52fa2

Please sign in to comment.