make sure index if >= 0

This commit is contained in:
dwelle 2025-03-22 10:41:18 +01:00
parent 2ed9d0ebdc
commit 15ece8a8cd

View file

@ -196,7 +196,7 @@ export const duplicateElements = (
index: number, index: number,
elements: ExcalidrawElement | null | ExcalidrawElement[], elements: ExcalidrawElement | null | ExcalidrawElement[],
) => { ) => {
invariant(index !== -1, "targetIndex === -1 "); invariant(index >= 0, "targetIndex must be >= 0");
if (!elements) { if (!elements) {
return; return;