From 0d3c566b02c6e9122fcaf601d9224d7f487a05c3 Mon Sep 17 00:00:00 2001 From: orlinmalkja <54899269+orlinmalkja@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:01:52 +0200 Subject: [PATCH] fix: remove error when annotations are null (#454) Co-authored-by: malkja --- src/stores/annotations.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stores/annotations.ts b/src/stores/annotations.ts index fbf69e9e..8a026748 100644 --- a/src/stores/annotations.ts +++ b/src/stores/annotations.ts @@ -99,7 +99,8 @@ export const useAnnotationsStore = defineStore('annotations', () => { }; - const addHighlightAttributesToText = (dom) => { + const addHighlightAttributesToText = (dom) => { + if (annotations.value !== null) { annotations.value.forEach((annotation) => { const { id } = annotation; const selector = Utils.generateTargetSelector(annotation); @@ -107,6 +108,7 @@ export const useAnnotationsStore = defineStore('annotations', () => { Utils.addHighlightToElements(selector, dom, id); } }); + } }; const annotationLoaded = (annotations) => {