diff --git a/ArmoredVehicle/FormMapWithSetMachine.cs b/ArmoredVehicle/FormMapWithSetMachine.cs index 7659439..f2a2d15 100644 --- a/ArmoredVehicle/FormMapWithSetMachine.cs +++ b/ArmoredVehicle/FormMapWithSetMachine.cs @@ -127,6 +127,11 @@ namespace ArmoredVehicle MainForm form = new(); if (form.ShowDialog() == DialogResult.OK) { + if (form.SelectedMachine == null) + { + MessageBox.Show("Вы не создали объект"); + return; + } DrawningObject machine = new(form.SelectedMachine); if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + machine != -1) { diff --git a/ArmoredVehicle/MapWithSetMachineGeneric.cs b/ArmoredVehicle/MapWithSetMachineGeneric.cs index e5fab20..8af5bfe 100644 --- a/ArmoredVehicle/MapWithSetMachineGeneric.cs +++ b/ArmoredVehicle/MapWithSetMachineGeneric.cs @@ -112,7 +112,6 @@ /// private void Shaking() { - int j = _setMachines.Count - 1; for (int i = 0; i < _setMachines.Count; i++) { @@ -134,7 +133,6 @@ } } } - } /// /// Метод отрисовки фона @@ -190,7 +188,6 @@ currentHeight++; } if (currentHeight > height) return; - } } diff --git a/ArmoredVehicle/SetMachineGeneric.cs b/ArmoredVehicle/SetMachineGeneric.cs index eb2a9a5..675f409 100644 --- a/ArmoredVehicle/SetMachineGeneric.cs +++ b/ArmoredVehicle/SetMachineGeneric.cs @@ -63,7 +63,6 @@ { if (position < _maxCount && position >= 0) { - if (_places.ElementAt(position) != null) { T result = _places.ElementAt(position); @@ -72,10 +71,8 @@ return result; } - return null; } - return null; } /// @@ -99,9 +96,7 @@ if (position < _maxCount && position >= 0) { Insert(this[position], position); - } - } }