1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-20 04:31:47 -05:00

FixedLengthInputStream - increment mCount only when read() succeeds

Patch by andrewgaul
This commit is contained in:
cketti 2011-11-28 01:10:41 +01:00
parent 969277f619
commit e145a621c7

View File

@ -27,8 +27,11 @@ public class FixedLengthInputStream extends InputStream {
@Override @Override
public int read() throws IOException { public int read() throws IOException {
if (mCount < mLength) { if (mCount < mLength) {
mCount++; int d = mIn.read();
return mIn.read(); if (d != -1) {
mCount++;
}
return d;
} else { } else {
return -1; return -1;
} }