aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tsage/core.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index f4118cb45e..6029a91daa 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2814,6 +2814,11 @@ void Visage::setVisage(int resNum, int rlbNum) {
if (rlbNum == 0)
rlbNum = 1;
+ // Check how many slots there are
+ uint16 count = READ_LE_UINT16(indexData);
+ if (rlbNum > count)
+ rlbNum = count;
+
// Get the flags/rlbNum to use
uint32 v = READ_LE_UINT32(indexData + (rlbNum - 1) * 4 + 2);
int flags = v >> 30;