From 94f5e90638d5ef05bf2130ea39827b434cd993f6 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 5 Sep 2020 14:02:30 +0200 Subject: [PATCH] Block accessing non-valid controllers --- src/input/ControllerManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input/ControllerManager.cpp b/src/input/ControllerManager.cpp index 46fa852..bccc551 100644 --- a/src/input/ControllerManager.cpp +++ b/src/input/ControllerManager.cpp @@ -85,7 +85,7 @@ void ControllerManager::processEvent(SDL_JoystickID joystickId, int32_t channel, channel = joystickToChannel[joystickId]; } } - if (channel != -1) { + if (channel != -1 && controllerList.contains(static_cast(channel))) { controllerList[static_cast(channel)]->update(e, screenWidth, screenHeight); } }