fix: createImageBitmap throws DOMException if source is 0 (#1422)
* fix: createImageBitmap throws DOMException if source is 0 * code review * fix * Create breezy-cats-heal.md * fix format --------- Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
169e10e94a
commit
8a93739766
@@ -184,6 +184,12 @@ export class CanvasManager {
|
||||
.forEach(async (canvas: HTMLCanvasElement) => {
|
||||
const id = this.mirror.getId(canvas);
|
||||
if (snapshotInProgressMap.get(id)) return;
|
||||
|
||||
// The browser throws if the canvas is 0 in size
|
||||
// Uncaught (in promise) DOMException: Failed to execute 'createImageBitmap' on 'Window': The source image width is 0.
|
||||
// Assuming the same happens with height
|
||||
if (canvas.width === 0 || canvas.height === 0) return;
|
||||
|
||||
snapshotInProgressMap.set(id, true);
|
||||
if (['webgl', 'webgl2'].includes((canvas as ICanvas).__context)) {
|
||||
// if the canvas hasn't been modified recently,
|
||||
|
||||
Reference in New Issue
Block a user