This commit is contained in:
tamaina 2023-05-06 17:50:43 +00:00
parent b7827f1cae
commit 6b8e60a7d4
1 changed files with 6 additions and 3 deletions

View File

@ -6,9 +6,12 @@ onmessage = (event) => {
if ('canvas' in event.data) { if ('canvas' in event.data) {
canvas = event.data.canvas; canvas = event.data.canvas;
} }
if (!(canvas && 'hash' in event.data && typeof event.data.hash === 'string')) { if (!canvas) {
console.error('Cannot draw blurhash without canvas and hash', canvas, event.data); console.error('Cannot draw blurhash without canvas', canvas, event.data);
throw new Error('Cannot draw blurhash without canvas and hash'); 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 width = event.data.width ?? 64;
const height = event.data.height ?? 64; const height = event.data.height ?? 64;