From: Jérôme Benoit Date: Sat, 17 Mar 2018 21:35:49 +0000 (+0100) Subject: TD2: Clearify the empty message detection logic. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=e2e6395d405aadaa84c836f743b208fde2a16afe;p=TD_SR.git TD2: Clearify the empty message detection logic. Signed-off-by: Jérôme Benoit --- diff --git a/TD2/IHM/IHM.java b/TD2/IHM/IHM.java index 5a43687..4e43c6d 100644 --- a/TD2/IHM/IHM.java +++ b/TD2/IHM/IHM.java @@ -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) {