Skip to content

Commit

Permalink
Merge pull request #5834 from nextcloud/fix/preview_undefined_prev
Browse files Browse the repository at this point in the history
fix(preview): prev token can be undefined in `isPreviewLinkInParagraph`
  • Loading branch information
mejo- committed May 27, 2024
2 parents 83f40ac + 311732a commit 45764d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/markdownit/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 45764d1

Please sign in to comment.