if (tsize.width <= 0 || tsize.height <= 0) return;
if (tsize.width <= 0 || tsize.height <= 0) { return; }
    protected void paintLayer(Graphics2D g2d, TileLayer layer) {        // Determine tile size and offset        Dimension tsize = getTileSize();        if (tsize.width <= 0 || tsize.height <= 0) return;        Polygon gridPoly = createGridPolygon(0, -tsize.height, 0);        // Determine area to draw from clipping rectangle        Rectangle clipRect = g2d.getClipBounds();        int startX = clipRect.x / tsize.width;        int startY = clipRect.y / tsize.height;        int endX = (clipRect.x + clipRect.width) / tsize.width + 1;        int endY = (clipRect.y + clipRect.height) / tsize.height + 3;        // (endY +2 for high tiles, could be done more properly)        // Draw this map layer        for (int y = startY, gy = (startY + 1) * tsize.height;                y < endY; y++, gy += tsize.height) {            for (int x = startX, gx = startX * tsize.width;                    x < endX; x++, gx += tsize.width) {                Tile tile = layer.getTileAt(x, y);                if (tile != null) {                    if (layer instanceof SelectionLayer) {                        gridPoly.translate(gx, gy);                        g2d.fillPolygon(gridPoly);                        gridPoly.translate(-gx, -gy);                        //paintEdge(g, layer, gx, gy);                    } else {                        tile.draw(g2d, gx, gy, zoom);                    }                }            }        }    }