aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-06-22 22:22:28 +0530
committerEugene Sandulenko2019-09-03 17:16:55 +0200
commitef7eaa925748c17765079b837eae5d42e6dd948e (patch)
tree346e3b2532e376258b92f8cbd4b50c7217d7302f
parent776b257e52477d5b161c5fc3cc1ad8a994def112 (diff)
downloadscummvm-rg350-ef7eaa925748c17765079b837eae5d42e6dd948e.tar.gz
scummvm-rg350-ef7eaa925748c17765079b837eae5d42e6dd948e.tar.bz2
scummvm-rg350-ef7eaa925748c17765079b837eae5d42e6dd948e.zip
HDB: Add NULL checking to getMapBG/FGTileFlags()
-rw-r--r--engines/hdb/map-loader.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/hdb/map-loader.cpp b/engines/hdb/map-loader.cpp
index 0e18a71ed9..0cf84e4f69 100644
--- a/engines/hdb/map-loader.cpp
+++ b/engines/hdb/map-loader.cpp
@@ -691,14 +691,20 @@ uint32 Map::getMapBGTileFlags(int x, int y) {
if (x < 0 || x >= _width || y < 0 || y >= _height) {
return 0;
}
- return g_hdb->_drawMan->getTile(_background[y * _width + x])->_flags;
+ Tile* tile = g_hdb->_drawMan->getTile(_foreground[y * _width + x]);
+ if (tile)
+ return tile->_flags;
+ return 0;
}
uint32 Map::getMapFGTileFlags(int x, int y) {
if (x < 0 || x >= _width || y < 0 || y >= _height) {
return 0;
}
- return g_hdb->_drawMan->getTile(_foreground[y * _width + x])->_flags;
+ Tile* tile = g_hdb->_drawMan->getTile(_foreground[y * _width + x]);
+ if (tile)
+ return tile->_flags;
+ return 0;
}
uint16 Map::getMapBGTileIndex(int x, int y) {