From c67815f7b032e7ea109a5debbae0ce7892c5e92b Mon Sep 17 00:00:00 2001 From: zsviczian Date: Sat, 3 Aug 2024 18:37:36 +0200 Subject: [PATCH] fix: Duplicating arrow without bound elements throws error (#8316) Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com> --- packages/excalidraw/element/binding.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/excalidraw/element/binding.ts b/packages/excalidraw/element/binding.ts index 3d6a0c57f..177278b35 100644 --- a/packages/excalidraw/element/binding.ts +++ b/packages/excalidraw/element/binding.ts @@ -1246,11 +1246,11 @@ export const fixBindingsAfterDuplication = ( .filter(({ id }) => allBindableElementIds.has(id)) .forEach((bindableElement) => { const oldElementId = duplicateIdToOldId.get(bindableElement.id); - const { boundElements } = sceneElements.find( + const boundElements = sceneElements.find( ({ id }) => id === oldElementId, - )!; + )?.boundElements; - if (boundElements != null && boundElements.length > 0) { + if (boundElements && boundElements.length > 0) { mutateElement(bindableElement, { boundElements: boundElements.map((boundElement) => oldIdToDuplicatedId.has(boundElement.id)