diff options
Diffstat (limited to 'engines/mads')
-rw-r--r-- | engines/mads/sprites.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 6488add86c..67d5e20fe5 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -402,10 +402,13 @@ void SpriteSets::remove(int idx) { } else if (idx >= 0) { delete (*this)[idx]; - if (idx == ((int)size() - 1)) - remove_at(size() - 1); - else + if (idx < ((int)size() - 1)) { (*this)[idx] = nullptr; + } else { + do { + remove_at(size() - 1); + } while (size() > 0 && (*this)[size() - 1] == nullptr); + } } } |