From 6b8e60a7d407b05670bf33091c543e1ff1aff8c8 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 6 May 2023 17:50:43 +0000 Subject: [PATCH] wip --- packages/frontend/src/workers/draw-blurhash.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/workers/draw-blurhash.ts b/packages/frontend/src/workers/draw-blurhash.ts index 6b5bb421f8..cbf8d39d72 100644 --- a/packages/frontend/src/workers/draw-blurhash.ts +++ b/packages/frontend/src/workers/draw-blurhash.ts @@ -6,9 +6,12 @@ onmessage = (event) => { if ('canvas' in event.data) { canvas = event.data.canvas; } - if (!(canvas && 'hash' in event.data && typeof event.data.hash === 'string')) { - console.error('Cannot draw blurhash without canvas and hash', canvas, event.data); - throw new Error('Cannot draw blurhash without canvas and hash'); + if (!canvas) { + console.error('Cannot draw blurhash without canvas', canvas, event.data); + throw new Error('Cannot draw blurhash without canvas'); + } + if (!('hash' in event.data && typeof event.data.hash === 'string')) { + return; } const width = event.data.width ?? 64; const height = event.data.height ?? 64;