DIRECTOR: Added sanity check to Score::getSpriteById()

This commit is contained in:
Eugene Sandulenko 2017-03-07 07:51:11 +01:00
parent 96f720d93d
commit 983237d912

View File

@ -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 {