aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
Diffstat (limited to 'scumm')
-rw-r--r--scumm/player_v2.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp
index 9c344c3dd4..0720477ab5 100644
--- a/scumm/player_v2.cpp
+++ b/scumm/player_v2.cpp
@@ -589,10 +589,15 @@ void Player_V2::execute_cmd(ChannelInfo *channel) {
break;
case 0xfd: // clear other channel
- value = READ_LE_UINT16 (script_ptr);
- debug(9, "clear channel %d", value/50);
+ value = READ_LE_UINT16 (script_ptr) / sizeof (ChannelInfo);
+ debug(9, "clear channel %d", value);
script_ptr += 2;
- channel = &_channels[value / sizeof(ChannelInfo)];
+ // In Indy3, when traveling to Venice a command is
+ // issued to clear channel 4, which is OOB. So, we
+ // check first.
+ if (value >= ARRAYSIZE (_channels))
+ break;
+ channel = &_channels[value];
// fall through
case 0xfa: // clear current channel