diff --git a/AntiAircraftGun/AntiAircraftGun/SetAntiAircraftGunsGeneric.cs b/AntiAircraftGun/AntiAircraftGun/SetAntiAircraftGunsGeneric.cs index 1270d41..9807595 100644 --- a/AntiAircraftGun/AntiAircraftGun/SetAntiAircraftGunsGeneric.cs +++ b/AntiAircraftGun/AntiAircraftGun/SetAntiAircraftGunsGeneric.cs @@ -56,7 +56,7 @@ namespace AntiAircraftGun /// public int Insert(T antiAircraftGun, int position) { - if (position < 0 || position > _places.Count) return -1; + if (position < 0 || position >= _places.Count) return -1; _places.Insert(position, antiAircraftGun); return position; } @@ -67,7 +67,7 @@ namespace AntiAircraftGun /// public T Remove(int position) { - if (position < 0 || position > _places.Count) return null; + if (position < 0 || position >= _places.Count) return null; if (_places[position] == null) return null; T removed = _places[position]; _places.RemoveAt(position); @@ -82,12 +82,12 @@ namespace AntiAircraftGun { get { - if (position < 0 || position > _places.Count) return null; + if (position < 0 || position >= _places.Count) return null; return _places[position]; } set { - if (position < 0 || position > _places.Count) return; + if (position < 0 || position >= _places.Count) return; _places.Insert(position, value); } }