From b8aebc75d3983b4ecb6c22cbd9ee76461a74a6cd Mon Sep 17 00:00:00 2001 From: hieplq Date: Fri, 22 Sep 2017 15:57:56 +0700 Subject: [PATCH] IDEMPIERE-3499:payment selection make NPE when hasn't bank account --- .../org/adempiere/webui/apps/form/WPaySelect.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java index 440b7c08ce..53a7f31b4f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WPaySelect.java @@ -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();