Фикс бага с удалением
This commit is contained in:
parent
494077af6a
commit
9bb3eb73a4
@ -71,17 +71,17 @@ namespace ProjectStormtrooper
|
|||||||
public T? Remove(int position)
|
public T? Remove(int position)
|
||||||
{
|
{
|
||||||
// Проверка позиции
|
// Проверка позиции
|
||||||
if (position < 0 || position >= Count)
|
if (position < 0 || position >= _maxCount)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Удаление объекта из массива, присвоив элементу массива значение null
|
if (position >= Count && position < _maxCount)
|
||||||
T? plane = _places[position];
|
|
||||||
if (plane == null)
|
|
||||||
{
|
{
|
||||||
throw new PlaneNotFoundException(position);
|
throw new PlaneNotFoundException(position);
|
||||||
}
|
}
|
||||||
_places[position] = null;
|
// Удаление объекта из массива, присвоив элементу массива значение null
|
||||||
|
T? plane = _places[position];
|
||||||
|
_places.RemoveAt(position);
|
||||||
return plane;
|
return plane;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user