diff --git a/WarmlyLocomotive/WarmlyLocomotive/FormLocomotiveCollection.cs b/WarmlyLocomotive/WarmlyLocomotive/FormLocomotiveCollection.cs
index 820d903..74f2420 100644
--- a/WarmlyLocomotive/WarmlyLocomotive/FormLocomotiveCollection.cs
+++ b/WarmlyLocomotive/WarmlyLocomotive/FormLocomotiveCollection.cs
@@ -44,6 +44,10 @@ public partial class FormLocomotiveCollection : Form
///
private void ButtonAddLocomotive_Click(object sender, EventArgs e)
{
+ if(_company == null)
+ {
+ return;
+ }
FormLocomotiveConfig form = new();
// TODO передать метод
form.AddEvent(SetLocomotive);
diff --git a/WarmlyLocomotive/WarmlyLocomotive/FormLocomotiveConfig.cs b/WarmlyLocomotive/WarmlyLocomotive/FormLocomotiveConfig.cs
index 03a0dec..4398f0b 100644
--- a/WarmlyLocomotive/WarmlyLocomotive/FormLocomotiveConfig.cs
+++ b/WarmlyLocomotive/WarmlyLocomotive/FormLocomotiveConfig.cs
@@ -16,7 +16,7 @@ public partial class FormLocomotiveConfig : Form
///
/// Событие для передачи объекта
///
- private event LocomotiveDelegate? LocomotiveDelegate;
+ private event Action? LocomotiveDelegate;
///
/// Конструктор
@@ -34,15 +34,13 @@ public partial class FormLocomotiveConfig : Form
panelBlue.MouseDown += Panel_MouseDown;
buttonCancel.Click += (events, e) => Close();
-
-
}
///
/// Привязка внешнего метода к событию
///
///
- public void AddEvent(LocomotiveDelegate locomotiveDelegate)
+ public void AddEvent(Action locomotiveDelegate)
{
LocomotiveDelegate += locomotiveDelegate;
}