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:
parent
969277f619
commit
e145a621c7
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user