From 915c8cea9c11d702f03818c298767b2ce4e1c065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0=20=D0=A8=D0=B8=D0=BF?= =?UTF-8?q?=D0=B8=D0=BB=D0=BE=D0=B2?= <116575516+LAYT73@users.noreply.github.com> Date: Mon, 29 Apr 2024 06:21:27 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D1=84=D1=80=D0=B0=D0=B3?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=82=D1=8B=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CollectionGenericObjects/AbstractCompany.cs | 8 ++++++-- .../CollectionGenericObjects/MassiveGenericObjects.cs | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/AbstractCompany.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/AbstractCompany.cs index 246c017..ccf4527 100644 --- a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/AbstractCompany.cs +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/AbstractCompany.cs @@ -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; diff --git a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/MassiveGenericObjects.cs index 7ee8e66..bcb6e76 100644 --- a/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectSeaplane/ProjectSeaplane/CollectionGenericObjects/MassiveGenericObjects.cs @@ -38,10 +38,10 @@ public class MassiveGenericObjects : ICollectionGenericObjects _collection = Array.Empty(); } - 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]; }