mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-21 18:32:08 +00:00
Don't set controls to keys out of array bounds
Shout-out to TAG's config that somehow had `setcontrol2 "custom3" "KEY931926528"`, cuasing the game to crash only in Splitscreen.
This commit is contained in:
parent
a6d49eaaa7
commit
f0daea39d4
1 changed files with 8 additions and 1 deletions
|
@ -662,7 +662,14 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
|||
return keystr[0];
|
||||
|
||||
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
||||
return atoi(&keystr[3]);
|
||||
{
|
||||
/* what if we out of range bruh? */
|
||||
j = atoi(&keystr[3]);
|
||||
if (j < NUMINPUTS)
|
||||
return j;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < NUMKEYNAMES; j++)
|
||||
if (!stricmp(keynames[j].name, keystr))
|
||||
|
|
Loading…
Reference in a new issue