diff --git a/src/renderer.ts b/src/renderer.ts index 28595e06..2b7ce0f2 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -953,7 +953,8 @@ function paint (_: DOMHighResTimeStamp) { if (pixelX >= 0 && pixelY >= 0 && (pixelX + width < canvas.width) - && (pixelY + charHeight < canvas.height)) { + && (pixelY + charHeight < canvas.height) + && width > 0 && charHeight > 0) { glyphCache[id] = context.getImageData( pixelX, pixelY,