From e2e6395d405aadaa84c836f743b208fde2a16afe Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 17 Mar 2018 22:35:49 +0100 Subject: [PATCH] TD2: Clearify the empty message detection logic. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- TD2/IHM/IHM.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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) { -- 2.34.1