diff --git a/Source/path.cpp b/Source/path.cpp index ac365f0e9..f8e92bb0f 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -285,6 +285,10 @@ bool GetPath(const std::function &posOk, PATHNODE *pPath, Point des bool IsTileNotSolid(Point position) { + if (position.x < 0 || position.y < 0 || position.x >= MAXDUNX || position.y >= MAXDUNY) { + return false; + } + return !nSolidTable[dPiece[position.x][position.y]]; }