diff --git a/src/game/collision.cpp b/src/game/collision.cpp index 016d9a456..ca0a59c44 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -182,7 +182,9 @@ int CCollision::GetTile(int x, int y) return 0; } int CCollision::Entity(int x, int y, bool Front) -{ +{ + if(0 < x || x >= m_Width) return 0; + if(0 < y || y >= m_Height) return 0; int Index = Front?m_pFront[y*m_Width+x].m_Index:m_pTiles[y*m_Width+x].m_Index; return Index-ENTITY_OFFSET; }