mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
SDLControllerInterface: Prevent crash with out-of-range buttons
This commit is contained in:
parent
e5a6103f74
commit
8a39969a61
|
@ -629,6 +629,9 @@ bool SDLControllerInterface::HandleControllerAxisEvent(const SDL_ControllerAxisE
|
|||
if (DoEventHook(Hook::Type::Axis, it->player_id, ev->axis, value))
|
||||
return true;
|
||||
|
||||
if (ev->axis >= MAX_NUM_AXES)
|
||||
return false;
|
||||
|
||||
const AxisCallback& cb = it->axis_mapping[ev->axis][AxisSide::Full];
|
||||
if (cb)
|
||||
{
|
||||
|
@ -707,6 +710,9 @@ bool SDLControllerInterface::HandleControllerButtonEvent(const SDL_ControllerBut
|
|||
return true;
|
||||
}
|
||||
|
||||
if (ev->button >= MAX_NUM_BUTTONS)
|
||||
return false;
|
||||
|
||||
const ButtonCallback& cb = it->button_mapping[ev->button];
|
||||
if (cb)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue