diff options
author | Eugene Sandulenko | 2017-03-07 07:51:11 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2017-03-07 07:51:38 +0100 |
commit | 983237d9122a3f1eec2f18d2b9fc499c76c400ed (patch) | |
tree | 35c9913d0149b3b939b1e832068ecc63d021a747 /engines | |
parent | 96f720d93d791c12dd1912ea06ff6928821c8c17 (diff) | |
download | scummvm-rg350-983237d9122a3f1eec2f18d2b9fc499c76c400ed.tar.gz scummvm-rg350-983237d9122a3f1eec2f18d2b9fc499c76c400ed.tar.bz2 scummvm-rg350-983237d9122a3f1eec2f18d2b9fc499c76c400ed.zip |
DIRECTOR: Added sanity check to Score::getSpriteById()
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/score.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 0d0be21f10..112e4b2fcb 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -1050,6 +1050,10 @@ void Score::processEvents() { } Sprite *Score::getSpriteById(uint16 id) { + if (_currentFrame >= _frames.size() || _currentFrame < 0 || id >= _frames[_currentFrame]->_sprites.size()) { + warning("Score::getSpriteById(%d): out of bounds. frame: %d", id, _currentFrame); + return nullptr; + } if (_frames[_currentFrame]->_sprites[id]) { return _frames[_currentFrame]->_sprites[id]; } else { |