From d333f620635e77f7427f1cd9362c61b4ea73fc25 Mon Sep 17 00:00:00 2001 From: DM0000 <98051919+DM0000@users.noreply.github.com> Date: Sun, 1 Dec 2024 18:19:29 -0700 Subject: [PATCH] add null checks with pop ups to required fields --- .../mekhq/gui/dialog/NewAtBContractDialog.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java b/MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java index 7590900e68..d3e5fe1d39 100644 --- a/MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java @@ -509,10 +509,27 @@ protected void updatePaymentMultiplier() { @Override protected void btnOKActionPerformed(ActionEvent evt) { + if (!btnOK.equals(evt.getSource())) { return; } + if (getCurrentEmployerCode() == null) { + JOptionPane.showMessageDialog(rootPane, "Make sure you set Employer!", + "Contract is Missing Field", JOptionPane.WARNING_MESSAGE); + return; + } + if (getCurrentEnemyCode() == null) { + JOptionPane.showMessageDialog(rootPane, "Make sure you set Enemy!", + "Contract is Missing Field", JOptionPane.WARNING_MESSAGE); + return; + } + if (cbPlanets.getSelectedItem() == null) { + JOptionPane.showMessageDialog(rootPane, "Make sure you set the Planet!", + "Contract is Missing Field", JOptionPane.WARNING_MESSAGE); + return; + } + AtBContract contract = (AtBContract) this.contract; contract.setName(txtName.getText());