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 } } } - } }