From 269ee1e98ef1645957276ba4160c96db307f1771 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Apr 2011 04:09:19 +0300 Subject: Add missing checks. --- src/map.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 23089db4e..f79539567 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1001,6 +1001,9 @@ Path Map::findPath(int startX, int startY, int destX, int destY, // Path to be built up (empty by default) Path path; + if (startX >= mWidth || startY >= mHeight) + return path; + // Declare open list, a list with open tiles sorted on F cost std::priority_queue openList; @@ -1601,6 +1604,9 @@ void SpecialLayer::addRoad(Path road) void SpecialLayer::clean() { + if (!mTiles) + return; + for (int f = 0; f < mWidth * mHeight; f ++) { MapItem *item = mTiles[f]; -- cgit v1.2.3-70-g09d2