From e3267a4e9bbae56a6569bdf1555ed32f57a4a1e4 Mon Sep 17 00:00:00 2001 From: Sirius902 <10891979+Sirius902@users.noreply.github.com> Date: Sun, 10 Jul 2022 18:40:00 -0700 Subject: [PATCH] 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 --- libultraship/libultraship/SDLController.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libultraship/libultraship/SDLController.cpp b/libultraship/libultraship/SDLController.cpp index 2d8e8bb0d5d..bc89cc78a77 100644 --- a/libultraship/libultraship/SDLController.cpp +++ b/libultraship/libultraship/SDLController.cpp @@ -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;