Future-proof SDL controller enum range check.

Issue #172.
This commit is contained in:
Muzychenko Andrey 2023-02-12 09:01:20 +03:00
parent 831c3f49bf
commit 1749a2ba09
1 changed files with 1 additions and 1 deletions

View File

@ -569,7 +569,7 @@ std::string GameInput::GetShortInputDescription() const
keyName = std::to_string(Value);
break;
case InputTypes::GameController:
if (Value >= SDL_CONTROLLER_BUTTON_A && Value < SDL_CONTROLLER_BUTTON_MAX)
if (Value >= SDL_CONTROLLER_BUTTON_A && Value < std::min(static_cast<int>(SDL_CONTROLLER_BUTTON_MAX), 21))
keyName = controllerButtons[Value];
else
keyName = std::to_string(Value);