HDB: Add NULL check to BG/FG tile animation

This commit is contained in:
Nipun Garg 2019-06-21 08:34:36 +05:30 committed by Eugene Sandulenko
parent 76e4758b2b
commit 60b4c33a9c

View File

@ -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++)