Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix crash on removing task list

Abdullah Atta479dec6998a5
diff --git a/packages/editor/src/extensions/task-list/component.tsx b/packages/editor/src/extensions/task-list/component.tsx
index ca2adefcb..42ff439ff 100644
--- a/packages/editor/src/extensions/task-list/component.tsx
+++ b/packages/editor/src/extensions/task-list/component.tsx
@@ -39,7 +39,7 @@ export function TaskListComponent(
const checked = stats.total > 0 && stats.total === stats.checked;
const isNested = useMemo(() => {
- if (!pos) return false;
+ if (!pos || editor.state.doc.nodeSize < pos) return false;
return editor.state.doc.resolve(pos).parent.type.name === TaskItem.name;
}, [editor.state.doc, pos]);