Skip to content

Commit

Permalink
Fixed division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Apr 25, 2019
1 parent 9fe8785 commit fca68ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fca68ac

Please sign in to comment.