From 0294a28ca083418f3fd5f511be8f3929d10ee925 Mon Sep 17 00:00:00 2001 From: Aaron Munger Date: Thu, 5 Jan 2023 10:06:36 -0800 Subject: [PATCH] attachment field can be null (#170584) --- extensions/ipynb/notebook-src/cellAttachmentRenderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/ipynb/notebook-src/cellAttachmentRenderer.ts b/extensions/ipynb/notebook-src/cellAttachmentRenderer.ts index 122c8267036..5ae4c13fcb6 100644 --- a/extensions/ipynb/notebook-src/cellAttachmentRenderer.ts +++ b/extensions/ipynb/notebook-src/cellAttachmentRenderer.ts @@ -22,7 +22,7 @@ export async function activate(ctx: RendererContext) { md.renderer.rules.image = (tokens: MarkdownItToken[], idx: number, options, env, self) => { const token = tokens[idx]; const src = token.attrGet('src'); - const attachments: Record> = env.outputItem.metadata.attachments; + const attachments: Record> | undefined = env.outputItem.metadata?.attachments; if (attachments && src) { const imageAttachment = attachments[src.replace('attachment:', '')]; if (imageAttachment) {