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
This commit is contained in:
usrdno 2011-03-25 23:46:14 -05:00
parent 7735bf804f
commit ededa0e1b6
1 changed files with 5 additions and 1 deletions

View File

@ -1127,7 +1127,11 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
if(tab.getSelectedIndex() == 4 & warehouseTbl.getRowCount() > 0) 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())}); 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); initAtpTab(M_Warehouse_ID);
} }