mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
SDLControllerInterface: Don't crash on unbound hat index
This commit is contained in:
parent
5fff104383
commit
5e0ebb5d5f
|
@ -497,6 +497,8 @@ bool SDLControllerInterface::HandleJoystickHatEvent(const SDL_JoyHatEvent* event
|
||||||
|
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
|
|
||||||
|
if (event->hat < it->hat_button_mapping.size())
|
||||||
|
{
|
||||||
if (const ButtonCallback& cb = it->hat_button_mapping[event->hat][0]; cb)
|
if (const ButtonCallback& cb = it->hat_button_mapping[event->hat][0]; cb)
|
||||||
{
|
{
|
||||||
cb(event->value & SDL_HAT_UP);
|
cb(event->value & SDL_HAT_UP);
|
||||||
|
@ -517,6 +519,7 @@ bool SDLControllerInterface::HandleJoystickHatEvent(const SDL_JoyHatEvent* event
|
||||||
cb(event->value & SDL_HAT_LEFT);
|
cb(event->value & SDL_HAT_LEFT);
|
||||||
processed = true;
|
processed = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return processed;
|
return processed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue