TD2: Clearify the empty message detection logic.
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 17 Mar 2018 21:35:49 +0000 (22:35 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 17 Mar 2018 21:35:49 +0000 (22:35 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
TD2/IHM/IHM.java

index 5a43687654e919f5b1a45c29905736824b7d6563..4e43c6d2d1e8feb65c3edc65e351cfc8156d0608 100644 (file)
@@ -94,10 +94,12 @@ public class IHM implements ActionListener {
             e.printStackTrace();
         }
         String mess = (String)sendMessages.remove(0);
-        if (mess.isEmpty())
+        if (!mess.isEmpty()) {
+            System.out.println("IHM -> message a envoyer : " + mess);
+            return randName + "> " + mess;
+        } else {
             return "";
-        System.out.println("IHM -> message a envoyer : " + mess);
-        return randName + "> " + mess;
+        }
     }
 
     public void writeMessage(String mess) {