Skip to content

Commit f4db85c

Browse files
committed
fix: improve error handling in emoji loading and ensure consistent comparison in canvas resizing
1 parent c48f6ab commit f4db85c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils/quote-generate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,19 +411,19 @@ class QuoteGenerate {
411411
try {
412412
const image = await loadImage(Buffer.from(emojiImageBase, 'base64'))
413413
emojiCache.set(emoji.found, image)
414-
} catch {
414+
} catch (error) {
415415
try {
416416
const fallbackImage = await loadImage(Buffer.from(fallbackEmojiImageJson[emoji.found], 'base64'))
417417
emojiCache.set(emoji.found, fallbackImage)
418-
} catch {
418+
} catch (fallbackError) {
419419
// Skip if both fail
420420
}
421421
}
422422
} else {
423423
try {
424424
const fallbackImage = await loadImage(Buffer.from(fallbackEmojiImageJson[emoji.found], 'base64'))
425425
emojiCache.set(emoji.found, fallbackImage)
426-
} catch {
426+
} catch (error) {
427427
// Skip if fails
428428
}
429429
}
@@ -702,7 +702,7 @@ class QuoteGenerate {
702702
const canvasResize = createCanvas(textWidth, lineY + fontSize)
703703
const canvasResizeCtx = canvasResize.getContext('2d')
704704

705-
let dx = (lineDirection == 'rtl') ? textWidth - maxWidth + fontSize * 2 : 0
705+
let dx = (lineDirection === 'rtl') ? textWidth - maxWidth + fontSize * 2 : 0
706706
canvasResizeCtx.drawImage(canvas, dx, 0)
707707

708708
return canvasResize

0 commit comments

Comments
 (0)