From ca1cbc19b736660a3eb4c1276071a8152911e1f1 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 21 Jul 2022 08:45:56 +0200 Subject: [PATCH] utils: PopTransform: Guard against negative indexes --- src/utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils.c b/src/utils.c index 48b182f..d5cafe5 100644 --- a/src/utils.c +++ b/src/utils.c @@ -673,6 +673,10 @@ SYMBOL_EXPORT void PushTransform(struct Game* game, ALLEGRO_TRANSFORM* t) { } SYMBOL_EXPORT void PopTransform(struct Game* game) { + if (game->_priv.transforms_no == 0) { + PrintConsole(game, "Tried to pop a non-existent transform!"); + return; + } al_use_transform(&game->_priv.transforms[--game->_priv.transforms_no]); }