Changed the check in game_change_state() to full bounds checking

This commit is contained in:
MeirGavish
2025-10-19 11:45:48 +03:00
parent 53d2e53d78
commit 462c040e9a
+2 -2
View File
@@ -1270,12 +1270,12 @@ void game_change_state(enum GameState new_game_state)
timer = TM_ZERO; // Reset the timer
state_info[game_state].substate = 0;
if (game_state != GAME_STATE_UNDEFINED)
if (game_state >= 0 && game_state < GAME_STATE_MAX)
{
state_info[game_state].on_exit();
}
if (new_game_state != GAME_STATE_UNDEFINED)
if (new_game_state >= 0 && new_game_state < GAME_STATE_MAX)
{
state_info[new_game_state].on_init();