From ccab9cd6204f38755676ae771e69d9b492b8fc96 Mon Sep 17 00:00:00 2001 From: BlasphemyGod Date: Tue, 8 Nov 2022 16:32:08 +0400 Subject: [PATCH] Fixes --- FormMapWithSetArtilleries.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/FormMapWithSetArtilleries.java b/FormMapWithSetArtilleries.java index 552512b..84de017 100644 --- a/FormMapWithSetArtilleries.java +++ b/FormMapWithSetArtilleries.java @@ -155,12 +155,17 @@ public class FormMapWithSetArtilleries extends JFrame { }); buttonShowDeleted.addActionListener(e -> { - FormArtillery dialog = new FormArtillery(deletedObjects.empty() ? null : ((DrawingObjectArtillery)deletedObjects.pop()).getArtillery()); - dialog.setSize(800, 500); - dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); - dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + if (!deletedObjects.empty()) { + DrawingObjectArtillery deleted = (DrawingObjectArtillery) deletedObjects.pop(); + FormArtillery dialog = new FormArtillery(deleted.getArtillery()); + dialog.setSize(800, 500); + dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL); + dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - dialog.setVisible(true); + dialog.setVisible(true); + } else { + JOptionPane.showMessageDialog(this, "Стек удалённых объектов пуст", "Провал", JOptionPane.INFORMATION_MESSAGE); + } }); buttonLeft.addActionListener(e -> {