aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/sprites.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index 67d5e20fe5..bc36b5575a 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -399,7 +399,7 @@ void SpriteSets::remove(int idx) {
if (idx == SPRITE_SLOTS_MAX_SIZE) {
delete _uiSprites;
_uiSprites = nullptr;
- } else if (idx >= 0) {
+ } else if (idx >= 0 && idx < (int)size()) {
delete (*this)[idx];
if (idx < ((int)size() - 1)) {