diff options
| author | german77 <juangerman-13@hotmail.com> | 2021-05-14 21:56:39 -0500 |
|---|---|---|
| committer | german77 <juangerman-13@hotmail.com> | 2021-05-15 08:27:19 -0500 |
| commit | 2d3df5d3f43a2b0a2c9d77bcc9df87e963098ed0 (patch) | |
| tree | 76547cf8bbc661a421b89969f1d07fe52d52942c /src/input_common | |
| parent | b41d05a12cfbb1f27cc84ff64d8d3c6234758c2a (diff) | |
input_common: Fix crash when controller disconnects
Diffstat (limited to 'src/input_common')
| -rw-r--r-- | src/input_common/sdl/sdl_impl.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index c918a333df..288557968a 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp @@ -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) { |
