Логирование удаления по некорректному индексу.

This commit is contained in:
Programmist73 2022-11-18 12:42:27 +04:00
parent fd417fc6b6
commit 15553c9fdd

View File

@ -59,22 +59,15 @@ namespace Airbus
//удаление объекта из набора с конкретной позиции
public T Remove(int position)
{
if (position < _maxCount && position >= 0)
if (position >= Count || position < 0)
{
if (_places.ElementAt(position) != null)
{
T result = _places.ElementAt(position);
_places.RemoveAt(position);
return result;
}
throw new PlaneNotFoundException(position);
}
return null;
T result = _places[position];
_places.RemoveAt(position);
return result;
}
//получение объекта из набора по позиции