aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-03-15 16:18:38 -0400
committerPaul Gilbert2015-03-15 16:18:38 -0400
commit9caed13d906b852cd90033a2df304d19f0f0e38c (patch)
tree0f6758f68debdf82f0568da720f0af757e386b84 /engines
parent74327cadad47824863f52fdb2b68d093b3a939a6 (diff)
downloadscummvm-rg350-9caed13d906b852cd90033a2df304d19f0f0e38c.tar.gz
scummvm-rg350-9caed13d906b852cd90033a2df304d19f0f0e38c.tar.bz2
scummvm-rg350-9caed13d906b852cd90033a2df304d19f0f0e38c.zip
MADS: Better handling for removing sprite sets
Diffstat (limited to 'engines')
-rw-r--r--engines/mads/sprites.cpp9
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);
+ }
}
}