Skip to content

Commit a53bb94

Browse files
committed
Add check for converting negative SDL_GameControllerButton to glyph
A SDL_GameControllerButton below 0 is out of array bounds, so that should trip the assert and return GLYPH_UNKNOWN just like when the value is too high.
1 parent f18f959 commit a53bb94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

desktop_version/src/ButtonGlyphs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ const char* BUTTONGLYPHS_get_wasd_text(void)
274274

275275
const char* BUTTONGLYPHS_sdlbutton_to_glyph(const SDL_GameControllerButton button)
276276
{
277-
if (button > SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
277+
if (button < 0 || button > SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
278278
{
279279
SDL_assert(0 && "Unhandled button!");
280280
return glyph[GLYPH_UNKNOWN];

0 commit comments

Comments
 (0)