From 311732acc27349edd60a844ebab6f7a9f17b33f4 Mon Sep 17 00:00:00 2001 From: Jonas Date: Mon, 27 May 2024 13:58:56 +0200 Subject: [PATCH] fix(preview): prev token can be undefined in `isPreviewLinkInParagraph` Fixes: nextcloud/collectives#1231 Signed-off-by: Jonas --- src/markdownit/preview.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdownit/preview.js b/src/markdownit/preview.js index 8f5a75aeb5c..9933cd743d4 100644 --- a/src/markdownit/preview.js +++ b/src/markdownit/preview.js @@ -27,7 +27,7 @@ */ function isPreviewLinkInParagraph(tokens, i) { const [prev, cur, next] = tokens.slice(i - 1, i + 2) - return prev.type === 'paragraph_open' + return prev?.type === 'paragraph_open' && cur.type === 'inline' && cur.children && cur.children.length === 3