Update canvas-renderer.ts (#2004)

* Update canvas-renderer.ts

Fixed an issue were a page wouldn't render.

Line 581 (now 582) threw exception: "Uncaught (in promise) DOMException: Failed to execute 'createPattern' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0."

* Update canvas-renderer.ts
This commit is contained in:
RickBetting 2019-09-22 04:33:48 +02:00 committed by Niklas von Hertzen
parent ee3ca35636
commit d4b58960dc

View File

@ -578,8 +578,10 @@ export class CanvasRenderer {
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, width, height);
const pattern = this.ctx.createPattern(canvas, 'repeat') as CanvasPattern;
this.renderRepeat(path, pattern, x, y);
if ((width > 0) && (height > 0)) {
const pattern = this.ctx.createPattern(canvas, 'repeat') as CanvasPattern;
this.renderRepeat(path, pattern, x, y);
}
} else if (isRadialGradient(backgroundImage)) {
const [path, left, top, width, height] = calculateBackgroundRendering(container, index, [
null,