Fix what is hopefully the last bug in getTileStructure/getTileFeature.

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8489 4a71c877-e1ca-e34f-864e-861f7616d084
master
Guangcong Luo 2009-11-23 00:38:11 +00:00 committed by Git SVN Gateway
parent 877e90e0ae
commit 8390044bb6
1 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ extern unsigned int WZ_DECL_CONST dirtyHypot(int deltaX, int deltaY);
static inline STRUCTURE *getTileStructure(UDWORD x, UDWORD y)
{
BASE_OBJECT * psObj = mapTile(x,y)->psObject;
if (psObj->type == OBJ_STRUCTURE)
if (psObj && psObj->type == OBJ_STRUCTURE)
{
return (STRUCTURE *)psObj;
}
@ -51,7 +51,7 @@ static inline STRUCTURE *getTileStructure(UDWORD x, UDWORD y)
static inline FEATURE *getTileFeature(UDWORD x, UDWORD y)
{
BASE_OBJECT * psObj = mapTile(x,y)->psObject;
if (psObj->type == OBJ_FEATURE)
if (psObj && psObj->type == OBJ_FEATURE)
{
return (FEATURE *)psObj;
}