Changed checking list.getSelectedIndex() for < 0 to checking list.getSelectedValue() for null.