Check rumble controller number is within the supported range
This commit is contained in:
parent
5397e8ae1a
commit
b878d64460
1 changed files with 5 additions and 0 deletions
|
|
@ -812,6 +812,11 @@ void SdlInputHandler::handleJoystickArrivalEvent(SDL_JoyDeviceEvent* event)
|
||||||
|
|
||||||
void SdlInputHandler::rumble(unsigned short controllerNumber, unsigned short lowFreqMotor, unsigned short highFreqMotor)
|
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)
|
// Check if the controller supports haptics (and if the controller exists at all)
|
||||||
SDL_Haptic* haptic = m_GamepadState[controllerNumber].haptic;
|
SDL_Haptic* haptic = m_GamepadState[controllerNumber].haptic;
|
||||||
if (haptic == nullptr) {
|
if (haptic == nullptr) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue