1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-17 07:30:16 -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
public int read() throws IOException {
if (mCount < mLength) {
mCount++;
return mIn.read();
int d = mIn.read();
if (d != -1) {
mCount++;
}
return d;
} else {
return -1;
}