Fix "bind showkeys" crash

git-svn-id: https://svn.eduke32.com/eduke32@8041 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-08-21 03:02:10 +00:00 committed by Christoph Oelckers
parent 10a909b0af
commit 97a1dea887
2 changed files with 4 additions and 4 deletions

View file

@ -421,7 +421,7 @@ void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode
int match = 0;
for (; sctokeylut[match].key; match++)
for (; match < ARRAY_SSIZE(sctokeylut); ++match)
{
if (keys[k] == sctokeylut[match].sc)
break;

View file

@ -897,8 +897,8 @@ static int osdcmd_bind(osdcmdptr_t parm)
{
if (parm->numparms==1 && !Bstrcasecmp(parm->parms[0],"showkeys"))
{
for (int i=0; sctokeylut[i].key; i++)
OSD_Printf("%s\n",sctokeylut[i].key);
for (auto & s : sctokeylut)
OSD_Printf("%s\n", s.key);
for (auto ConsoleButton : ConsoleButtons)
OSD_Printf("%s\n",ConsoleButton);
return OSDCMD_OK;
@ -1064,7 +1064,7 @@ static int osdcmd_unbind(osdcmdptr_t parm)
if (parm->numparms != 1)
return OSDCMD_SHOWHELP;
for (auto ConsoleKey : sctokeylut)
for (auto & ConsoleKey : sctokeylut)
{
if (ConsoleKey.key && !Bstrcasecmp(parm->parms[0], ConsoleKey.key))
{