diff --git a/frontend/src/components/ui/ComposeCanvas.tsx b/frontend/src/components/ui/ComposeCanvas.tsx index c94bc68..f0f5012 100644 --- a/frontend/src/components/ui/ComposeCanvas.tsx +++ b/frontend/src/components/ui/ComposeCanvas.tsx @@ -401,6 +401,8 @@ export const ComposeCanvas = forwardRef< fabricRef.current?.add(img); fabricRef.current?.setActiveObject(img); + if (!fabricRef.current) return; + logicalSizeRef.current.height = measureLogicalContentHeight( fabricRef.current, logicalSizeRef.current.height, diff --git a/frontend/src/pages/Reader.tsx b/frontend/src/pages/Reader.tsx index 4f7337f..72630a6 100644 --- a/frontend/src/pages/Reader.tsx +++ b/frontend/src/pages/Reader.tsx @@ -69,7 +69,8 @@ export default function Reader() { ) : await cryptoUtils.decryptMetadata( { encrypted_content: encrypted_metadata, encrypted_dek }, - masterKey, + // biome-ignore lint/style/noNonNullAssertion: masterKey is guaranteed to be non-null here as isDecryptionKeyAvailable is true + masterKey!, ); setMetadata(decryptedMetadata as LetterMetadata); @@ -81,7 +82,8 @@ export default function Reader() { ) : await cryptoUtils.decryptLetter( { encrypted_content, encrypted_dek }, - masterKey, + // biome-ignore lint/style/noNonNullAssertion: masterKey is guaranteed to be non-null here as isDecryptionKeyAvailable is true + masterKey!, ); const canvasData: CanvasJSON = JSON.parse(decryptedContent); @@ -100,7 +102,8 @@ export default function Reader() { canvasData, images, encrypted_dek, - masterKey, + // biome-ignore lint/style/noNonNullAssertion: masterKey is guaranteed to be non-null here as isDecryptionKeyAvailable is true + masterKey!, cryptoUtils, ); } @@ -108,7 +111,7 @@ export default function Reader() { setWarning({ message: "Failed to decrypt elements. Images might not render in the letter as intended.", - log: err, + log: err instanceof Error ? err.message : "Unknown error", }); }