input_common: Fix crash when controller disconnects

master
german77 2021-05-14 21:56:39 +07:00
parent 85eeae7aad
commit edd498f6e0
1 changed files with 3 additions and 1 deletions

@ -267,7 +267,9 @@ void SDLState::CloseJoystick(SDL_Joystick* sdl_joystick) {
return joystick->GetSDLJoystick() == sdl_joystick;
});
(*joystick_it)->SetSDLJoystick(nullptr, nullptr);
if (joystick_it != joystick_guid_list.end()) {
(*joystick_it)->SetSDLJoystick(nullptr, nullptr);
}
}
void SDLState::HandleGameControllerEvent(const SDL_Event& event) {