From 1749a2ba09ac8e9bbe63d1e17f4765d4b1ba902a Mon Sep 17 00:00:00 2001 From: Muzychenko Andrey <33288308+k4zmu2a@users.noreply.github.com> Date: Sun, 12 Feb 2023 09:01:20 +0300 Subject: [PATCH] Future-proof SDL controller enum range check. Issue #172. --- SpaceCadetPinball/options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpaceCadetPinball/options.cpp b/SpaceCadetPinball/options.cpp index 85f2c6a..e8761cb 100644 --- a/SpaceCadetPinball/options.cpp +++ b/SpaceCadetPinball/options.cpp @@ -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(SDL_CONTROLLER_BUTTON_MAX), 21)) keyName = controllerButtons[Value]; else keyName = std::to_string(Value);