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-Tag: v0.1.4^2~20 X-Git-Url: https://git.pterodactylus.net/?p=jFCPlib.git;a=commitdiff_plain;h=a061300d59fefdb2cbac25d3ee1658fecc3d1cbf Avoid one case of getting out of synch and trying to read too much. --- 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; + } } }