Skip to content

Commit

Permalink
add null checks with pop ups to required fields
Browse files Browse the repository at this point in the history
  • Loading branch information
DM0000 committed Dec 2, 2024
1 parent ef649cb commit d333f62
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions MekHQ/src/mekhq/gui/dialog/NewAtBContractDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit d333f62

Please sign in to comment.