From 7c4f43c156306121eecb70ad41518927c24163e6 Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Sun, 28 Jul 2019 09:24:13 +0200 Subject: [PATCH] Don't try to draw chess pieces with size 0 Trying to create a 0 size bitmap fails with IllegalArgumentException. --- .../src/main/java/org/petero/droidfish/view/ChessBoard.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DroidFishApp/src/main/java/org/petero/droidfish/view/ChessBoard.java b/DroidFishApp/src/main/java/org/petero/droidfish/view/ChessBoard.java index 759d37a..dd186c5 100644 --- a/DroidFishApp/src/main/java/org/petero/droidfish/view/ChessBoard.java +++ b/DroidFishApp/src/main/java/org/petero/droidfish/view/ChessBoard.java @@ -377,6 +377,8 @@ public abstract class ChessBoard extends View { final int width = getWidth(); final int height = getHeight(); sqSize = Math.min(getSqSizeW(width), getSqSizeH(height)); + if (sqSize <= 0) + return; labelPaint.setTextSize(sqSize/4.0f); decorationPaint.setTextSize(sqSize/3.0f); computeOrigin(width, height);