From a41cc95abba54c1faced074180068bc82f51f86d Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 12 Jun 2023 20:26:56 -0300 Subject: [PATCH] added security check to avoid errors on building empty flows --- src/frontend/src/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/frontend/src/utils.ts b/src/frontend/src/utils.ts index e13f26745..b1b3c96c9 100644 --- a/src/frontend/src/utils.ts +++ b/src/frontend/src/utils.ts @@ -744,6 +744,9 @@ export function validateNode(n: NodeType, reactFlowInstance:ReactFlowInstance):A } export function validateNodes(reactFlowInstance:ReactFlowInstance){ + if(reactFlowInstance.getNodes().length === 0){ + return ["No nodes found in the flow. Please add at least one node to the flow."]; + } return reactFlowInstance .getNodes() .flatMap((n: NodeType) => validateNode(n, reactFlowInstance));