소스 검색

fix: Duplicating arrow without bound elements throws error (#8316)

Co-authored-by: David Luzar <[email protected]>
zsviczian 1 년 전
부모
커밋
c67815f7b0
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      packages/excalidraw/element/binding.ts

+ 3 - 3
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)