1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Only set game.customscript if index is inbounds

game.customscript is an unnecessary middleman, but it will be kept
around for compatibility reasons. However, it's still possible to crash
the game, so I'm adding this bounds check.
This commit is contained in:
Misa 2020-07-09 23:03:16 -07:00 committed by Ethan Lee
parent 8c42f82317
commit ca9e4c8f6e

View File

@ -1773,7 +1773,10 @@ void mapclass::loadlevel(int rx, int ry)
break;
}
case 19: //Script Box
game.customscript[tempscriptbox]=edentity[edi].scriptname;
if (INBOUNDS_ARR(tempscriptbox, game.customscript))
{
game.customscript[tempscriptbox]=edentity[edi].scriptname;
}
obj.createblock(1, (edentity[edi].x*8)- ((rx-100)*40*8), (edentity[edi].y*8)- ((ry-100)*30*8),
edentity[edi].p1*8, edentity[edi].p2*8, 300+tempscriptbox, "custom_" + edentity[edi].scriptname);
tempscriptbox++;