소스 검색

Fix - binding to nonexistent element

zsviczian 1 년 전
부모
커밋
16c0417f5b
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      packages/excalidraw/element/binding.ts

+ 3 - 0
packages/excalidraw/element/binding.ts

@@ -828,6 +828,9 @@ const bindingBorderTest = (
   { x, y }: { x: number; y: number },
   app: AppClassProperties,
 ): boolean => {
+  if(!element || !element.width || !element.height) {
+    return false;
+  }
   const threshold = maxBindingGap(element, element.width, element.height);
   const shape = app.getElementShape(element);
   return isPointOnShape([x, y], shape, threshold);