From 38ab8ac353dcdd42e00bacdfc98322b64f9061b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 30 May 2015 00:51:35 +0200 Subject: [PATCH] Don't add count=-1 to bytesRead when finished --- F-Droid/src/org/fdroid/fdroid/net/Downloader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/F-Droid/src/org/fdroid/fdroid/net/Downloader.java b/F-Droid/src/org/fdroid/fdroid/net/Downloader.java index 746fcc1c7..cf9dfa170 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/Downloader.java +++ b/F-Droid/src/org/fdroid/fdroid/net/Downloader.java @@ -173,12 +173,12 @@ public abstract class Downloader { int count = input.read(buffer); throwExceptionIfInterrupted(); - bytesRead += count; - sendProgress(bytesRead, totalBytes); if (count == -1) { Log.d(TAG, "Finished downloading from stream"); break; } + bytesRead += count; + sendProgress(bytesRead, totalBytes); outputStream.write(buffer, 0, count); } outputStream.flush();