Skip to content

Commit

Permalink
Merge pull request #5270 from DM0000/NullContractValuesFix
Browse files Browse the repository at this point in the history
Null checks in manual contract generation
  • Loading branch information
HammerGS authored Dec 2, 2024
2 parents 2301f16 + d333f62 commit de87aeb
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 de87aeb

Please sign in to comment.