From 767d645bfad1a8dd84a7de7980f86b84a5b0202a Mon Sep 17 00:00:00 2001
From: "vincent.steinman" <vincent.steinmann@etu.hesge.ch>
Date: Mon, 30 Jan 2023 17:06:22 +0100
Subject: [PATCH] Edit: selected_id + instanceof

---
 tp/src/main/java/com/example/tpfx/HelloController.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tp/src/main/java/com/example/tpfx/HelloController.java b/tp/src/main/java/com/example/tpfx/HelloController.java
index 890ee72..abd1367 100644
--- a/tp/src/main/java/com/example/tpfx/HelloController.java
+++ b/tp/src/main/java/com/example/tpfx/HelloController.java
@@ -251,11 +251,11 @@ public class HelloController {
         contactArray.get(selected_id).setEmail(emails);
         contactArray.get(selected_id).setSocial(social);
         contactArray.get(selected_id).setJob(job);
-        if(contactArray.get(LstCt.getSelectionModel().getSelectedIndex()) instanceof Family){
+        if(contactArray.get(selected_id) instanceof Family){
             Family fam = (Family)contactArray.get(selected_id);
             fam.setRelation(other);
             contactArray.set(selected_id, fam);
-        } else if(contactArray.get(LstCt.getSelectionModel().getSelectedIndex()).getType().equals("Professional")){
+        } else if(contactArray.get(selected_id) instanceof Professional){
             Professional pro = (Professional)contactArray.get(selected_id);
             pro.setWork(other);
             contactArray.set(selected_id, pro);
-- 
GitLab