From b878d6446049bdd76ad3dcb80e930da48c1c461f Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 12 Feb 2019 22:05:55 -0800 Subject: [PATCH] Check rumble controller number is within the supported range --- app/streaming/input.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/streaming/input.cpp b/app/streaming/input.cpp index 4a6c885a..e6993081 100644 --- a/app/streaming/input.cpp +++ b/app/streaming/input.cpp @@ -812,6 +812,11 @@ void SdlInputHandler::handleJoystickArrivalEvent(SDL_JoyDeviceEvent* event) void SdlInputHandler::rumble(unsigned short controllerNumber, unsigned short lowFreqMotor, unsigned short highFreqMotor) { + // Make sure the controller number is within our supported count + if (controllerNumber >= MAX_GAMEPADS) { + return; + } + // Check if the controller supports haptics (and if the controller exists at all) SDL_Haptic* haptic = m_GamepadState[controllerNumber].haptic; if (haptic == nullptr) {