PIBD-11 Shipilov N.S. Seaplane Simple LabWork7 #7

Closed
NikitaShipilov wants to merge 2 commits from LabWork7 into LabWork6
2 changed files with 8 additions and 4 deletions
Showing only changes of commit 915c8cea9c - Show all commits

View File

@ -49,8 +49,12 @@ public abstract class AbstractCompany
SetObjectsPosition();
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
{
DrawingPlane? obj = _collection?.Get(i);
obj?.DrawTransport(graphics);
try
{
DrawingPlane? obj = _collection?.Get(i);
obj?.DrawTransport(graphics);
}
catch (Exception) { }
}
return bitmap;

View File

@ -38,10 +38,10 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
_collection = Array.Empty<T?>();
}
public T Get(int position)
public T? Get(int position)
{
if (position >= _collection.Length || position < 0) throw new PositionOutOfCollectionException(position);
//if (_collection[position] == null) throw new ObjectNotFoundException(position);
if (_collection[position] == null) throw new ObjectNotFoundException(position);
return _collection[position];
}