File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
library/src/main/java/com/loopj/android/http Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -376,7 +376,7 @@ byte[] getResponseData(HttpEntity entity) throws IOException {
376
376
if (contentLength > Integer .MAX_VALUE ) {
377
377
throw new IllegalArgumentException ("HTTP entity too large to be buffered in memory" );
378
378
}
379
- int buffersize = (contentLength < 0 ) ? BUFFER_SIZE : (int ) contentLength ;
379
+ int buffersize = (contentLength <= 0 ) ? BUFFER_SIZE : (int ) contentLength ;
380
380
try {
381
381
ByteArrayBuffer buffer = new ByteArrayBuffer (buffersize );
382
382
try {
@@ -386,7 +386,7 @@ byte[] getResponseData(HttpEntity entity) throws IOException {
386
386
while ((l = instream .read (tmp )) != -1 && !Thread .currentThread ().isInterrupted ()) {
387
387
count += l ;
388
388
buffer .append (tmp , 0 , l );
389
- sendProgressMessage (count , (int ) contentLength );
389
+ sendProgressMessage (count , (int ) ( contentLength <= 0 ? 1 : contentLength ) );
390
390
}
391
391
} finally {
392
392
AsyncHttpClient .silentCloseInputStream (instream );
You can’t perform that action at this time.
0 commit comments