Don't close controller after SDL has quit (#642)

* Don't close controller after SDL has quit

* Don't check if controller can rumble if null
This commit is contained in:
Sirius902 2022-07-10 18:40:00 -07:00 committed by GitHub
parent 926fd3f406
commit e3267a4e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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;