From 504ea1e2a339c15e2f8aaf77411dc996c0a633ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=A7=D1=83=D0=B1?= =?UTF-8?q?=D1=8B=D0=BA=D0=B8=D0=BD=D0=B0?= Date: Sat, 23 Dec 2023 16:17:34 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BB=D0=B0=D0=B1=D1=8B=207?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sailboat/Sailboat/BoatsGenericCollection.cs | 5 ++++- Sailboat/Sailboat/BoatsGenericStorage.cs | 1 - Sailboat/Sailboat/FormBoatCollection.cs | 4 ---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Sailboat/Sailboat/BoatsGenericCollection.cs b/Sailboat/Sailboat/BoatsGenericCollection.cs index 9c5176d..dccf834 100644 --- a/Sailboat/Sailboat/BoatsGenericCollection.cs +++ b/Sailboat/Sailboat/BoatsGenericCollection.cs @@ -74,7 +74,10 @@ namespace Sailboat.Generics public static T? operator -(BoatsGenericCollection collect, int pos) { T? obj = collect._collection[pos]; - collect._collection.Remove(pos); + if (obj != null) + { + collect._collection.Remove(pos); + } return obj; } diff --git a/Sailboat/Sailboat/BoatsGenericStorage.cs b/Sailboat/Sailboat/BoatsGenericStorage.cs index a730d37..2e94e5e 100644 --- a/Sailboat/Sailboat/BoatsGenericStorage.cs +++ b/Sailboat/Sailboat/BoatsGenericStorage.cs @@ -184,6 +184,5 @@ namespace Sailboat.Generics } } } - } } diff --git a/Sailboat/Sailboat/FormBoatCollection.cs b/Sailboat/Sailboat/FormBoatCollection.cs index a24afc8..7f90c09 100644 --- a/Sailboat/Sailboat/FormBoatCollection.cs +++ b/Sailboat/Sailboat/FormBoatCollection.cs @@ -130,8 +130,6 @@ namespace Sailboat MessageBox.Show(ex.Message); _logger.LogWarning($"{ex.Message} из набора {listBoxStorages.SelectedItem.ToString()}"); } - - } private void buttonRefreshCollection_Click(object sender, EventArgs e) @@ -147,7 +145,6 @@ namespace Sailboat return; } pictureBoxCollection.Image = obj.ShowBoats(); - } private void buttonAddObject_Click(object sender, EventArgs e) @@ -222,6 +219,5 @@ namespace Sailboat } } } - } }