diff --git a/packages/core/src/container/EdgeRenderer/utils.ts b/packages/core/src/container/EdgeRenderer/utils.ts index edd74543..0bf08e2d 100644 --- a/packages/core/src/container/EdgeRenderer/utils.ts +++ b/packages/core/src/container/EdgeRenderer/utils.ts @@ -77,10 +77,10 @@ export function getHandle(bounds: HandleElement[], handleId?: string | null): Ha return null; } - if (handleId) { - return bounds.find((d) => d.id === handleId)!; - } else if (bounds.length === 1) { + if (bounds.length === 1 || !handleId) { return bounds[0]; + } else if (handleId) { + return bounds.find((d) => d.id === handleId) || null; } return null;