Skip to content

Commit

Permalink
fix: fix divide by zero on calculating average speed when download co…
Browse files Browse the repository at this point in the history
…mpleted and connected at the same time

Closes #601
  • Loading branch information
Jacksgong committed Jun 8, 2017
1 parent 2e6818c commit ac22c7c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void end(long sofarBytes) {
long downloadSize = sofarBytes - mStartSofarBytes;
this.mLastRefreshTime = 0;
long interval = SystemClock.uptimeMillis() - mStartTime;
if (interval < 0) {
if (interval <= 0) {
mSpeed = (int) downloadSize;
} else {
mSpeed = (int) (downloadSize / interval);
Expand Down

0 comments on commit ac22c7c

Please sign in to comment.