Skip to content

Commit

Permalink
Don't close controller after SDL has quit (#642)
Browse files Browse the repository at this point in the history
* Don't close controller after SDL has quit

* Don't check if controller can rumble if null
  • Loading branch information
Sirius902 authored Jul 11, 2022
1 parent 926fd3f commit e3267a4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libultraship/libultraship/SDLController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ namespace Ship {
}

bool SDLController::Close() {
if (CanRumble()) {
SDL_GameControllerRumble(Cont, 0, 0, 0);
}
if (Cont != nullptr) {
if (Cont != nullptr && SDL_WasInit(SDL_INIT_GAMECONTROLLER)) {
if (CanRumble()) {
SDL_GameControllerRumble(Cont, 0, 0, 0);
}
SDL_GameControllerClose(Cont);
}
Cont = nullptr;
Expand Down

0 comments on commit e3267a4

Please sign in to comment.