Fix DefaultHttpDataSource read when requested length is 0

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134063990
This commit is contained in:
olly 2016-09-23 05:35:42 -07:00 committed by Oliver Woodman
parent 669cf6804a
commit 654d914bb6

View File

@ -547,11 +547,8 @@ public class DefaultHttpDataSource implements HttpDataSource {
* @throws IOException If an error occurs reading from the source.
*/
private int readInternal(byte[] buffer, int offset, int readLength) throws IOException {
readLength = bytesToRead == C.LENGTH_UNSET ? readLength
: (int) Math.min(readLength, bytesToRead - bytesRead);
if (readLength == 0) {
// We've read all of the requested data.
return C.RESULT_END_OF_INPUT;
return 0;
}
int read = inputStream.read(buffer, offset, readLength);