From ededa0e1b6bb61e6ff99f99956ef4c502d050448 Mon Sep 17 00:00:00 2001 From: usrdno Date: Fri, 25 Mar 2011 23:46:14 -0500 Subject: [PATCH] If no warehouse row is selected in the warehouse tab, use the first warehouse row to prevent index out of bounds exception. Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=3051361 --- .../src/org/compiere/apps/search/InfoProduct.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoProduct.java b/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoProduct.java index d327eb67c4..3834a226af 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoProduct.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/search/InfoProduct.java @@ -1127,7 +1127,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener if(tab.getSelectedIndex() == 4 & warehouseTbl.getRowCount() > 0) { - String value = (String)warehouseTbl.getValueAt(warehouseTbl.getSelectedRow(),0); + // If no warehouse row is selected in the warehouse tab, use the first warehouse + // row to prevent array index out of bounds. BF 3051361 + int selectedRow = warehouseTbl.getSelectedRow(); + if (selectedRow<0) selectedRow = 0; + String value = (String)warehouseTbl.getValueAt(selectedRow,0); int M_Warehouse_ID = DB.getSQLValue(null, "SELECT M_Warehouse_ID FROM M_Warehouse WHERE UPPER(Name) = UPPER(?) AND AD_Client_ID=?", new Object[] { value ,Env.getAD_Client_ID(Env.getCtx())}); initAtpTab(M_Warehouse_ID); }