From c20ea0c523c7c8523c2f522f18bada8299075d0d Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Wed, 26 Feb 2025 05:39:46 +1100 Subject: [PATCH] [TS] Add null check in graph to prompt (#2727) --- src/utils/executionUtil.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/executionUtil.ts b/src/utils/executionUtil.ts index c537848c0..314c2a327 100644 --- a/src/utils/executionUtil.ts +++ b/src/utils/executionUtil.ts @@ -76,7 +76,10 @@ export const graphToPrompt = async ( if (!parent) continue let link = node.getInputLink(i) - while (parent.mode === LGraphEventMode.BYPASS || parent.isVirtualNode) { + while ( + parent?.mode === LGraphEventMode.BYPASS || + parent?.isVirtualNode + ) { if (!link) break if (parent.isVirtualNode) { @@ -95,7 +98,7 @@ export const graphToPrompt = async ( const indexes = [link.origin_slot].concat(parentInputIndexes) const matchingIndex = indexes.find( - (index) => parent.inputs[index]?.type === input.type + (index) => parent?.inputs[index]?.type === input.type ) // No input types match if (matchingIndex === undefined) break