Fixed crash.

This commit is contained in:
Felix Ableitner 2013-09-02 19:28:54 +02:00
parent 61e2d5ea8c
commit b526a291d7

View file

@ -334,7 +334,8 @@ Generator::findClosestFloor(const Vector2i& start) const {
Vector2i current = std::min_element(open.begin(), open.end())->first;
open.erase(current);
closed.insert(current);
if (mTiles.at(current.x).at(current.y) == Tile::Type::FLOOR)
if (mTiles.count(current.x) != 0 && mTiles.at(current.x).count(current.y) != 0 &&
mTiles.at(current.x).at(current.y) == Tile::Type::FLOOR)
return current;
else {
insertNew(Vector2i(current.x + 1, current.y));