Make sure mapTile coordinates are greater than 0, too (fix possible crash).

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8588 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2009-11-30 04:27:14 +00:00 committed by Git SVN Gateway
parent 269c6026d2
commit 32a6e8d722
1 changed files with 2 additions and 0 deletions

View File

@ -294,6 +294,8 @@ static inline WZ_DECL_PURE MAPTILE *mapTile(UDWORD x, UDWORD y)
{
ASSERT_OR_RETURN(0, x < mapWidth, "x coordinate %u bigger than map width %u", x, mapWidth);
ASSERT_OR_RETURN(0, y < mapHeight, "y coordinate %u bigger than map height %u", y, mapHeight);
ASSERT_OR_RETURN(0, x >= 0, "x coordinate %u less than 0", x);
ASSERT_OR_RETURN(0, y >= 0, "y coordinate %u less than 0", y);
return &psMapTiles[x + (y * mapWidth)];
}