diff options
author | Nipun Garg | 2019-06-21 08:34:36 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:54 +0200 |
commit | 60b4c33a9c5643322f093b62e2df8985705bbbb6 (patch) | |
tree | 6a5d6ae65bb09c9683912a5fb6c0b699d4f3dc39 | |
parent | 76e4758b2b1551a7354f72f416f6a23ab49eb754 (diff) | |
download | scummvm-rg350-60b4c33a9c5643322f093b62e2df8985705bbbb6.tar.gz scummvm-rg350-60b4c33a9c5643322f093b62e2df8985705bbbb6.tar.bz2 scummvm-rg350-60b4c33a9c5643322f093b62e2df8985705bbbb6.zip |
HDB: Add NULL check to BG/FG tile animation
-rw-r--r-- | engines/hdb/map-loader.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/engines/hdb/map-loader.cpp b/engines/hdb/map-loader.cpp index 249c52a9f4..dfbd1a82ce 100644 --- a/engines/hdb/map-loader.cpp +++ b/engines/hdb/map-loader.cpp @@ -717,7 +717,10 @@ void Map::addBGTileAnimation(int x, int y) { int i = y * _width + x; - uint32 flags = g_hdb->_drawMan->getTile(_background[i])->_flags; + Tile *tile = g_hdb->_drawMan->getTile(_background[i]); + if (!tile) + return; + uint32 flags = tile->_flags; // BACKGROUND if (flags & kFlagAnimFast) { @@ -733,7 +736,10 @@ void Map::addFGTileAnimation(int x, int y) { int i = y * _width + x; - uint32 flags = g_hdb->_drawMan->getTile(_foreground[i])->_flags; + Tile *tile = g_hdb->_drawMan->getTile(_foreground[i]); + if (!tile) + return; + uint32 flags = tile->_flags; // FOREGROUND if (flags & kFlagAnimFast) { @@ -748,7 +754,10 @@ void Map::addFGTileAnimation(int x, int y) { void Map::removeBGTileAnimation(int x, int y) { int i = y * _width + x; - uint32 flags = g_hdb->_drawMan->getTile(_background[i])->_flags; + Tile *tile = g_hdb->_drawMan->getTile(_background[i]); + if (!tile) + return; + uint32 flags = tile->_flags; if (flags & kFlagAnimFast) { for(Common::Array<uint32>::iterator it = _listBGAnimFast.begin(); it!=_listBGAnimFast.end(); it++) @@ -774,7 +783,10 @@ void Map::removeBGTileAnimation(int x, int y) { void Map::removeFGTileAnimation(int x, int y) { int i = y * _width + x; - uint32 flags = g_hdb->_drawMan->getTile(_foreground[i])->_flags; + Tile *tile = g_hdb->_drawMan->getTile(_foreground[i]); + if (!tile) + return; + uint32 flags = tile->_flags; if (flags & kFlagAnimFast) { for(Common::Array<uint32>::iterator it = _listFGAnimFast.begin(); it!=_listFGAnimFast.end(); it++) |