database management
[RRRRHHHH_Code] / ruralHouses / src / gui / listOfAdditionRequestsGUI.java
index 0fbf336..db65fb2 100644 (file)
@@ -85,7 +85,7 @@ public class listOfAdditionRequestsGUI extends JFrame {
                JButton btnNewButton = new JButton("Confirm Addition");
                btnNewButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
-                               if (table.getRowCount()!=0) {
+                               if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
                                        HouseManagerInterface hm = new HouseManager();
                                        RuralHouse rh = houses.get(table.getSelectedRow());
                                        //TODO when the house is not added show a warning to the user. Method below returns a boolean stating that.