Skip to content

Commit 3248583

Browse files
committed
stop crashing in BufferedSocketInputStream#read
1 parent 908b5a1 commit 3248583

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/java/com/github/shyiko/mysql/binlog/io/BufferedSocketInputStream.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public int read(byte[] b, int off, int len) throws IOException {
6060
}
6161
offset = 0;
6262
limit = in.read(buffer, 0, buffer.length);
63+
64+
if (limit == -1) {
65+
return -1;
66+
}
6367
}
6468
int bytesRemainingInBuffer = Math.min(len, limit - offset);
6569
System.arraycopy(buffer, offset, b, off, bytesRemainingInBuffer);

0 commit comments

Comments
 (0)