From fca68ac170ae62198a6ae94401831251956560c0 Mon Sep 17 00:00:00 2001 From: Gianlu Date: Thu, 25 Apr 2019 20:51:19 +0200 Subject: [PATCH] Fixed division by zero --- CommonUtils | 2 +- .../java/com/gianlu/aria2app/Adapters/BitfieldVisualizer.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CommonUtils b/CommonUtils index e84c2d70d..afc02905b 160000 --- a/CommonUtils +++ b/CommonUtils @@ -1 +1 @@ -Subproject commit e84c2d70deed9459d9ef6c285a5404c7d66e8cea +Subproject commit afc02905b3ff5db6fc986b3e65cda1836d35d02c diff --git a/app/src/main/java/com/gianlu/aria2app/Adapters/BitfieldVisualizer.java b/app/src/main/java/com/gianlu/aria2app/Adapters/BitfieldVisualizer.java index 58e24574e..ec2c2a7c0 100644 --- a/app/src/main/java/com/gianlu/aria2app/Adapters/BitfieldVisualizer.java +++ b/app/src/main/java/com/gianlu/aria2app/Adapters/BitfieldVisualizer.java @@ -199,7 +199,8 @@ protected void onDraw(Canvas canvas) { if (i >= squares) break; if (binary[i] != 0) { - if (i == squares - 1) paint.setAlpha(255 / (numPieces % 4) * binary[i]); + if (i == squares - 1 && numPieces % 4 != 0) + paint.setAlpha(255 / (numPieces % 4) * binary[i]); else paint.setAlpha(255 / 4 * binary[i]); calcSquarePos(row, column, rect);