From 3a52a8698088dfd624dff101822adeab56327ea4 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 22 Nov 2025 16:28:56 +0100 Subject: [PATCH] fix(components): add undefined checks in TipTap.vue - Add null check for DataTransferItem from items array - Add undefined checks for check.children[1] before accessing - Extract secondChild variable for safer access --- frontend/src/components/input/editor/TipTap.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/input/editor/TipTap.vue b/frontend/src/components/input/editor/TipTap.vue index 45aaa36c9..8221ef32d 100644 --- a/frontend/src/components/input/editor/TipTap.vue +++ b/frontend/src/components/input/editor/TipTap.vue @@ -361,7 +361,7 @@ const PasteHandler = Extension.create({ for (let i = 0; i < event.clipboardData.items.length; i++) { const item = event.clipboardData.items[i] - if (item.kind === 'file' && item.type.startsWith('image/')) { + if (item && item.kind === 'file' && item.type.startsWith('image/')) { const file = item.getAsFile() if (file) { uploadAndInsertFiles([file]) @@ -761,7 +761,10 @@ watch( // We assume the first child contains the label element with the checkbox and the second child the actual label // When the actual label is clicked, we forward that click to the checkbox. - check.children[1].removeEventListener('click', clickTasklistCheckbox) + const secondChild = check.children[1] + if (secondChild) { + secondChild.removeEventListener('click', clickTasklistCheckbox) + } }) return @@ -774,8 +777,11 @@ watch( // We assume the first child contains the label element with the checkbox and the second child the actual label // When the actual label is clicked, we forward that click to the checkbox. - check.children[1].removeEventListener('click', clickTasklistCheckbox) - check.children[1].addEventListener('click', clickTasklistCheckbox) + const secondChild = check.children[1] + if (secondChild) { + secondChild.removeEventListener('click', clickTasklistCheckbox) + secondChild.addEventListener('click', clickTasklistCheckbox) + } }) }, {immediate: true},