Don't try to draw chess pieces with size 0

Trying to create a 0 size bitmap fails with IllegalArgumentException.
This commit is contained in:
Peter Osterlund 2019-07-28 09:24:13 +02:00
parent 6a9af8206b
commit 7c4f43c156

View File

@ -377,6 +377,8 @@ public abstract class ChessBoard extends View {
final int width = getWidth(); final int width = getWidth();
final int height = getHeight(); final int height = getHeight();
sqSize = Math.min(getSqSizeW(width), getSqSizeH(height)); sqSize = Math.min(getSqSizeW(width), getSqSizeH(height));
if (sqSize <= 0)
return;
labelPaint.setTextSize(sqSize/4.0f); labelPaint.setTextSize(sqSize/4.0f);
decorationPaint.setTextSize(sqSize/3.0f); decorationPaint.setTextSize(sqSize/3.0f);
computeOrigin(width, height); computeOrigin(width, height);