diff --git a/WarmlyShip/WarmlyShip/AbstractMap.cs b/WarmlyShip/WarmlyShip/AbstractMap.cs index 21023c3..b05b4fd 100644 --- a/WarmlyShip/WarmlyShip/AbstractMap.cs +++ b/WarmlyShip/WarmlyShip/AbstractMap.cs @@ -38,7 +38,7 @@ namespace WarmlyShip { for (int j = (int)(position.Left / _size_x); j <= (int)(position.Right / _size_x); ++j) { - if (i >= 0 && j >= 0 && _map[i, j] == _barrier) return false; + if (i >= 0 && j >= 0 && i < _map.GetLength(0) && j < _map.GetLength(1) && _map[i, j] == _barrier) return false; } } return true;