IDEMPIERE-3499:payment selection make NPE when hasn't bank account

This commit is contained in:
hieplq 2017-09-22 15:57:56 +07:00
parent 4055d6db4d
commit b8aebc75d3
1 changed files with 11 additions and 3 deletions

View File

@ -272,9 +272,11 @@ public class WPaySelect extends PaySelect
*/
private void loadBankInfo()
{
BankInfo bi = (BankInfo)fieldBankAccount.getSelectedItem().getValue();
if (bi == null)
if (fieldBankAccount.getItemCount() == 0)
return;
BankInfo bi = (BankInfo)fieldBankAccount.getSelectedItem().getValue();
labelCurrency.setText(bi.Currency);
labelBalance.setText(m_format.format(bi.Balance));
@ -301,7 +303,13 @@ public class WPaySelect extends PaySelect
miniTable.setColorCompare(payDate);
if (log.isLoggable(Level.CONFIG)) log.config("PayDate=" + payDate);
BankInfo bi = (BankInfo)fieldBankAccount.getSelectedItem().getValue();
if (fieldBankAccount.getItemCount() == 0) {
FDialog.error(m_WindowNo, form, "VPaySelectNoBank");
return;
}
BankInfo bi = fieldBankAccount.getSelectedItem().getValue();
ValueNamePair paymentRule = (ValueNamePair) fieldPaymentRule.getSelectedItem().getValue();
KeyNamePair bpartner = (KeyNamePair) fieldBPartner.getSelectedItem().getValue();