From: Debora Wöpcke Date: Sat, 6 Jun 2015 19:06:54 +0000 (+0200) Subject: Avoid one case of getting out of synch and trying to read too much. X-Git-Url: https://git.pterodactylus.net/?p=jFCPlib.git;a=commitdiff_plain;h=da0b1a6f1dbb7373901d7a7b8179fafc134caca3 Avoid one case of getting out of synch and trying to read too much. Signed-off-by: David ‘Bombe’ Roden --- diff --git a/src/main/java/net/pterodactylus/fcp/FcpUtils.java b/src/main/java/net/pterodactylus/fcp/FcpUtils.java index 415cf1a..26a407c 100644 --- a/src/main/java/net/pterodactylus/fcp/FcpUtils.java +++ b/src/main/java/net/pterodactylus/fcp/FcpUtils.java @@ -268,7 +268,9 @@ public class FcpUtils { throw new EOFException("stream reached eof"); } destination.write(buffer, 0, read); - remaining -= read; + if (remaining > 0) { + remaining -= read; + } } }