diff options
| author | Paul Gilbert | 2014-04-28 22:36:49 -0400 |
|---|---|---|
| committer | Paul Gilbert | 2014-04-28 22:36:49 -0400 |
| commit | cd74c7eac5d5c8f2c6a00b339f510c77b63a2942 (patch) | |
| tree | a469bfffc9b8765841c1577b8e4cbc773cff4a70 /engines | |
| parent | 4f435d5e1c7096c22890332da89b4c574b542d7b (diff) | |
| download | scummvm-rg350-cd74c7eac5d5c8f2c6a00b339f510c77b63a2942.tar.gz scummvm-rg350-cd74c7eac5d5c8f2c6a00b339f510c77b63a2942.tar.bz2 scummvm-rg350-cd74c7eac5d5c8f2c6a00b339f510c77b63a2942.zip | |
MADS: Further workarounds for player data being accessed during cutscenes
Diffstat (limited to 'engines')
| -rw-r--r-- | engines/mads/player.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 3b727b397e..2049042e07 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -202,7 +202,9 @@ void Player::selectSeries() { } // If the user isn't to be present (such as for a cutscene), exit immediately - if ((_spritesStart + _spritesIdx) < 0) + // WORKAROUND: Original didn't do a secondary check for the sprite set being + // present, but it's needed to prevent invalid reads during cutscenes + if ((_spritesStart + _spritesIdx) < 0 || !_spriteSetsPresent[_spritesIdx]) return; SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; @@ -223,7 +225,8 @@ void Player::selectSeries() { } void Player::updateFrame() { - if ((_spritesStart + _spritesIdx) < 0) + // WORKAROUND: Prevent character info being referenced when not present + if ((_spritesStart + _spritesIdx) < 0 || !_spriteSetsPresent[_spritesStart + _spritesIdx]) return; Scene &scene = _vm->_game->_scene; @@ -497,7 +500,7 @@ void Player::idle() { return; } - if ((_spritesStart + _spritesIdx) < 0) + if ((_spritesStart + _spritesIdx) < 0 || !_spriteSetsPresent[_spritesStart + _spritesIdx]) return; SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; |
