Prevent "unexpected read attempt" illegal state exception

When using cronet data source, calling read after the end of input has
been read will trigger this.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184667794
This commit is contained in:
aquilescanta 2018-02-06 05:47:07 -08:00 committed by Oliver Woodman
parent 784e8a6344
commit fea75f2e42

View File

@ -369,6 +369,7 @@ public class CronetDataSource extends UrlRequest.Callback implements HttpDataSou
throw new HttpDataSourceException(exception, currentDataSpec,
HttpDataSourceException.TYPE_READ);
} else if (finished) {
bytesRemaining = 0;
return C.RESULT_END_OF_INPUT;
} else {
// The operation didn't time out, fail or finish, and therefore data must have been read.