diff --git a/src/graphic/helper/roundSector.ts b/src/graphic/helper/roundSector.ts index 7a09f2c90..9ba5f313b 100644 --- a/src/graphic/helper/roundSector.ts +++ b/src/graphic/helper/roundSector.ts @@ -145,8 +145,13 @@ export function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: { innerRadius = tmp; } + const { startAngle, endAngle } = shape; + if (isNaN(startAngle) || isNaN(endAngle)) { + return; + } + + const { cx, cy } = shape; const clockwise = !!shape.clockwise; - const { startAngle, endAngle, cx, cy, cornerRadius } = shape; let arc = mathAbs(endAngle - startAngle); const mod = arc > PI2 && arc % PI2; @@ -201,6 +206,7 @@ export function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: { const hasArc = arc > e; if (hasArc) { + const cornerRadius = shape.cornerRadius; if (cornerRadius) { [icrStart, icrEnd, ocrStart, ocrEnd] = normalizeCornerRadius(cornerRadius); } diff --git a/test/sector.html b/test/sector.html index bc2510151..bbf31db1c 100644 --- a/test/sector.html +++ b/test/sector.html @@ -220,6 +220,21 @@ // clockwise: false } })); + + // should show nothing + zr.add(new zrender.Sector({ + position: [400, 650], + scale: [1, 1], + style: { + stroke: 'black', + lineWidth: 10 + }, + shape: { + startAngle: NaN, + endAngle: NaN, + r: 100 + } + }));