diff --git a/FormMapWithSetLocomotives.java b/FormMapWithSetLocomotives.java index fe5e7ae..4806d24 100644 --- a/FormMapWithSetLocomotives.java +++ b/FormMapWithSetLocomotives.java @@ -293,6 +293,9 @@ public class FormMapWithSetLocomotives extends JComponent { //первой лабораторной), передавая туда элемент из коллекции //удаленных, если там есть DrawningObjectLocomotive locomotive = _mapsCollection.Get(listBoxMaps.getSelectedValue().toString()).getDeleted(); + if (locomotive == null) { + JOptionPane.showMessageDialog(null, "No deleted objects"); + } if (locomotive != null) { JDialog dialog = new JDialog(formFrame, "Deleted", true); FormLocomotive formLocomotive = new FormLocomotive(dialog); diff --git a/MapWithSetLocomotivesGeneric.java b/MapWithSetLocomotivesGeneric.java index c9c8eec..4a8f5e6 100644 --- a/MapWithSetLocomotivesGeneric.java +++ b/MapWithSetLocomotivesGeneric.java @@ -48,7 +48,7 @@ public class MapWithSetLocomotivesGeneric { T temp = this._setLocomotives.Remove(position); if (temp == null) return null; - if (temp instanceof DrawningObjectLocomotive) deletedLocomotives.add((DrawningObjectLocomotive) temp); + deletedLocomotives.add((DrawningObjectLocomotive) temp); return temp; } /// Вывод всего набора объектов