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
|
@ -662,7 +662,14 @@ INT32 G_KeyStringtoNum(const char *keystr)
|
||||||
return keystr[0];
|
return keystr[0];
|
||||||
|
|
||||||
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
|
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++)
|
for (j = 0; j < NUMKEYNAMES; j++)
|
||||||
if (!stricmp(keynames[j].name, keystr))
|
if (!stricmp(keynames[j].name, keystr))
|
||||||
|
|
Loading…
Reference in New Issue