Skip to content

Commit 43b1d23

Browse files
billyvgmydea
andcommitted
fix(canvas): createImageBitmap throws when canvas size is 0 (#170)
Fixes https://sentry.sentry.io/issues/4747137532/?project=11276 --------- Co-authored-by: Francesco Novy <francesco.novy@sentry.io>
1 parent d0996b9 commit 43b1d23

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/rrweb/src/record/observers/canvas/canvas-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export class CanvasManager implements CanvasManagerInterface {
347347
// The browser throws if the canvas is 0 in size
348348
// Uncaught (in promise) DOMException: Failed to execute 'createImageBitmap' on 'Window': The source image width is 0.
349349
// Assuming the same happens with height
350-
if (canvas.width === 0 || canvas.height === 0) return;
350+
if (!canvas.width || !canvas.height) return;
351351

352352
snapshotInProgressMap.set(id, true);
353353
if (

0 commit comments

Comments
 (0)