From a323b124aa6e35d34a899f15762580cfff8d1559 Mon Sep 17 00:00:00 2001 From: tyxz0 Date: Sun, 28 Apr 2024 23:27:04 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=BE=D0=B1=D1=8F=D0=B7=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D0=B0=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CollectionGenericObjects/ListGenericObjects.cs | 2 +- .../CollectionGenericObjects/StorageCollection.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DoubleDeckerBus/DoubleDeckerBus/CollectionGenericObjects/ListGenericObjects.cs b/DoubleDeckerBus/DoubleDeckerBus/CollectionGenericObjects/ListGenericObjects.cs index 8c4c3b5..e0aa358 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/CollectionGenericObjects/ListGenericObjects.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/CollectionGenericObjects/ListGenericObjects.cs @@ -42,7 +42,7 @@ public class ListGenericObjects : ICollectionGenericObjects public int Insert(T obj, int position) { - if (Count >= _maxCount || position < 0 || position > _maxCount) + if (Count >= _maxCount || position < 0 || position >= _maxCount) { return -1; } diff --git a/DoubleDeckerBus/DoubleDeckerBus/CollectionGenericObjects/StorageCollection.cs b/DoubleDeckerBus/DoubleDeckerBus/CollectionGenericObjects/StorageCollection.cs index 1a19758..47ef55d 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/CollectionGenericObjects/StorageCollection.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/CollectionGenericObjects/StorageCollection.cs @@ -52,7 +52,10 @@ public class StorageCollection public void DelCollection(string name) { - _storages.Remove(name); + if (_storages.ContainsKey(name)) + { + _storages.Remove(name); + } } public ICollectionGenericObjects? this[string name]