diff --git a/TileEngine/structure.cpp b/TileEngine/structure.cpp index f6193022..b52dd037 100644 --- a/TileEngine/structure.cpp +++ b/TileEngine/structure.cpp @@ -1221,6 +1221,9 @@ STRUCTURE * FindStructure( INT16 sGridNo, UINT32 fFlags ) { // finds a structure that matches any of the given flags STRUCTURE * pCurrent; + if( sGridNo > WORLD_MAX-1 ) + return( NULL ); + pCurrent = gpWorldLevelData[sGridNo].pStructureHead; while (pCurrent != NULL) {